ETH Price: $2,469.27 (-20.22%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Approve217584222025-02-02 11:06:4717 hrs ago1738494407IN
The Soup Game: SOUP Token
0 ETH0.000165433.6
Approve217495102025-02-01 5:13:4747 hrs ago1738386827IN
The Soup Game: SOUP Token
0 ETH0.000062072.37570899
Approve217495022025-02-01 5:12:1147 hrs ago1738386731IN
The Soup Game: SOUP Token
0 ETH0.000116342.52775646
Approve217494762025-02-01 5:06:5947 hrs ago1738386419IN
The Soup Game: SOUP Token
0 ETH0.00013332.9
Approve217477782025-01-31 23:25:352 days ago1738365935IN
The Soup Game: SOUP Token
0 ETH0.000081381.76827371
Approve217449972025-01-31 14:06:352 days ago1738332395IN
The Soup Game: SOUP Token
0 ETH0.000316666.87820498
Approve217449672025-01-31 14:00:352 days ago1738332035IN
The Soup Game: SOUP Token
0 ETH0.000281626.11718874
Approve217449192025-01-31 13:50:592 days ago1738331459IN
The Soup Game: SOUP Token
0 ETH0.000284786.19531998
Approve217442852025-01-31 11:43:232 days ago1738323803IN
The Soup Game: SOUP Token
0 ETH0.00018073.90276272
Approve217425742025-01-31 5:58:352 days ago1738303115IN
The Soup Game: SOUP Token
0 ETH0.000146993.17462471
Approve217425372025-01-31 5:50:592 days ago1738302659IN
The Soup Game: SOUP Token
0 ETH0.000083261.80056074
Approve217387332025-01-30 17:05:113 days ago1738256711IN
The Soup Game: SOUP Token
0 ETH0.000221947.66957493
Approve217387312025-01-30 17:04:473 days ago1738256687IN
The Soup Game: SOUP Token
0 ETH0.000226017.81004511
Approve217365712025-01-30 9:50:593 days ago1738230659IN
The Soup Game: SOUP Token
0 ETH0.000093012.01145557
Approve217358382025-01-30 7:23:353 days ago1738221815IN
The Soup Game: SOUP Token
0 ETH0.000087491.9
Approve217358342025-01-30 7:22:473 days ago1738221767IN
The Soup Game: SOUP Token
0 ETH0.000090781.97195491
Approve217317862025-01-29 17:49:594 days ago1738172999IN
The Soup Game: SOUP Token
0 ETH0.000228624.93750307
Approve217304192025-01-29 13:15:114 days ago1738156511IN
The Soup Game: SOUP Token
0 ETH0.000135492.93013656
Approve217299632025-01-29 11:43:234 days ago1738151003IN
The Soup Game: SOUP Token
0 ETH0.000139483.01644882
Approve217276702025-01-29 4:02:355 days ago1738123355IN
The Soup Game: SOUP Token
0 ETH0.000148563.22859881
Approve217248462025-01-28 18:34:595 days ago1738089299IN
The Soup Game: SOUP Token
0 ETH0.000375938.12962558
Approve217225162025-01-28 10:46:235 days ago1738061183IN
The Soup Game: SOUP Token
0 ETH0.000198394.30935342
Approve217216902025-01-28 8:00:235 days ago1738051223IN
The Soup Game: SOUP Token
0 ETH0.000138575.30143081
Approve217216892025-01-28 8:00:115 days ago1738051211IN
The Soup Game: SOUP Token
0 ETH0.000228694.96744814
Approve217216652025-01-28 7:55:235 days ago1738050923IN
The Soup Game: SOUP Token
0 ETH0.000249185.38167386
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Soup

Compiler Version
v0.8.25+commit.b61c2a91

Optimization Enabled:
Yes with 200 runs

Other Settings:
cancun EvmVersion
File 1 of 24 : soup.sol
pragma solidity ^0.8.22;

import '@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol';
import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import "abdk-libraries-solidity/ABDKMath64x64.sol";
import './ERC20PresetMinterRebaser.sol';
import './interfaces/ISoup.sol';


// Welcome to THE SOUP GAME.
// lfg to https://soup.game and play.
//
// Yes, this contract will be renounced once game
// mechanics are proven to be fair and balanced.
//
// SOUP, because... it's what the people want.
// Obviously.

/**
 * @title Soup Token Contract
 * @dev ERC20 token with deflationary mechanics and reward freezing functionality
 */
contract Soup is ERC20PresetMinterRebaser, Ownable {
  using ABDKMath64x64 for int128;

  /**
   * @notice Internal decimals used to handle scaling factor
   */
  uint256 public constant internalDecimals = 10**18;

  int128 public MIN_SCALE_FACTOR = ABDKMath64x64.fromUInt(1e9).div(ABDKMath64x64.fromUInt(10**18));

  mapping(address => uint256) internal _soupBalances;

  mapping(address => mapping(address => uint256)) internal _allowedFragments;

  int128 public deflationRate;
  uint256 public _debaseStartedAt;
  uint256 public _lastDebasedAt;

  uint256 public rewardsRequestedAt;
  uint256 public totalUnderlyingSupply;
  uint256 public _frozen;

  // keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
  bytes32 public constant PERMIT_TYPEHASH =
    0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
  bytes32 public DOMAIN_SEPARATOR;

  mapping(address => uint256) public nonces;

  /// @notice The EIP-712 typehash for the contract's domain
  bytes32 public constant DOMAIN_TYPEHASH =
    keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");

  uint256 public initialSupply;

  // Soup island:
  uint256 public frozenForRewards;

  event Mint(address to, uint256 amount);
  event Burn(address from, uint256 amount);

  modifier validRecipient(address to) {
    require(to != address(0));
    require(to != address(this));
    _;
  }

  int128 public scaleFactor;

  /**
   * @dev Constructor initializes the token with an initial supply and sets the domain separator
   */
  constructor() ERC20PresetMinterRebaser("soup.game", "SOUP") {
    initialSupply = 100_000_000 * 10**decimals();

    setDomainSeparator();

    int128 one = ABDKMath64x64.fromUInt(1);
    deflationRate = one.sub(ABDKMath64x64.divu(3, 10000000));
    scaleFactor = deflationRate.pow(0);

    uint256 rewards = initialSupply * 7 / 10;
    freezeForRewards(rewards);

    _mint(owner(), initialSupply - rewards);
  }

  /**
   * @dev Sets the domain separator for EIP-712
   */
  function setDomainSeparator() internal {
    uint256 chainId_;
    assembly { chainId_ := chainid() }
    DOMAIN_SEPARATOR = keccak256(
      abi.encode(
        keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
        keccak256(bytes("SOUP")),
        keccak256(bytes("1")),
        chainId_,
        address(this)
      )
    );
  }

  /**
   * @dev Starts the debase process by setting the debase start timestamp
   */
  function startDebase() external onlyOwner {
    _debaseStartedAt = block.timestamp;
  }

  /**
   * @notice Gets the timestamp when debase started
   * @return The timestamp when debase started
   */
  function debaseStartedAt() public view returns (uint256){
    return _debaseStartedAt == 0 ? block.timestamp : _debaseStartedAt;
  }

  /**
   * @notice Gets the current scaling factor
   * @return The current scaling factor
   */
  function soupScalingFactor() public view returns (uint256) {
    return scaleFactor.mulu(internalDecimals);
  }

  /**
   * @notice Gets the duration of the debase period
   * @return The duration of the debase period in seconds
   */
  function debaseDuration() public view returns (uint256) {
    return block.timestamp - debaseStartedAt();
  }

  /**
   * @dev Debases the token by updating the scaling factor
   */
  function debase() public {
    if ( _debaseStartedAt > 0 && block.timestamp - _lastDebasedAt > 60) {
      int128 newScaleFactor = deflationRate.pow(debaseDuration());
      if (newScaleFactor >= MIN_SCALE_FACTOR) {
        _lastDebasedAt = block.timestamp;
        scaleFactor = newScaleFactor;
        if (address(lpPair) != address(0)) lpPair.sync();
      }
    }
  }

  /**
   * @notice Gets the total supply of tokens
   * @return The total supply of tokens
   */
  function totalSupply() public view override returns (uint256) {
    return maxSupply() - frozenForRewards;
  }

  /**
   * @notice Gets the total liquid supply of tokens
   * @return The total liquid supply of tokens
   */
  function totalLiquidSupply() public view returns (uint256) {
    return _soupToFragment(totalUnderlyingSupply);
  }

  /**
   * @notice Gets the maximum supply of tokens
   * @return The maximum supply of tokens
   */
  function maxSupply() public view returns (uint256) {
    return totalLiquidSupply() + _frozen;
  }

  /**
   * @notice Gets the maximum scaling factor
   * @return The maximum scaling factor
   */
  function maxScalingFactor() public view returns (uint256) {
    return uint256(int256(-1)) / totalUnderlyingSupply;
  }

  /**
   * @notice Requests a percentage of the remaining
   *         rewards by unfreezing tokens
   * @param rewardBips Basis points of the rewards to request
   */
  function requestRewards(uint256 rewardBips) external {
    require(hasRole(MINTER_ROLE, _msgSender()), "Must have minter role");
    uint256 amount = frozenForRewards * rewardBips / 10_000;
    frozenForRewards -= amount;
    unfreeze(msg.sender, amount);
  }

  /**
   * @dev Freezes tokens for rewards
   * @param amount The amount of tokens to freeze
   */
  function freezeForRewards(uint256 amount) internal {
    frozenForRewards = amount;
    _frozen += amount;
  }

  /**
   * @notice Freezes tokens from the caller's balance
   * @param amount The amount of tokens to freeze
   */
  function freeze(uint256 amount) public {
    require(hasRole(MINTER_ROLE, _msgSender()), "Must have minter role");
    _burn(amount, msg.sender);
    _frozen += amount;
  }

  /**
   * @notice Unfreezes tokens to a specified address
   * @param to The address to receive the unfrozen tokens
   * @param amount The amount of tokens to unfreeze
   * @return True on success, false otherwise
   */
  function unfreeze(address to, uint256 amount) public returns (bool) {
    require(hasRole(MINTER_ROLE, _msgSender()), "Must have minter role");

    _frozen -= amount;
    _mint(to, amount);
    return true;
  }

  /**
   * @notice Mints new tokens, increasing totalSupply, totalUnderlyingSupply, and the user's balance
   * @param to The address to receive the minted tokens
   * @param amount The amount of tokens to mint
   * @return True on success, false otherwise
   */
  function mint(address to, uint256 amount) external returns (bool) {
    require(hasRole(MINTER_ROLE, _msgSender()), "Must have minter role");

    _mint(to, amount);
    return true;
  }

  /**
   * @dev Internal function to mint new tokens
   * @param to The address to receive the minted tokens
   * @param amount The amount of tokens to mint
   */
  function _mint(address to, uint256 amount) internal override {
    uint256 soupValue = _fragmentToSoup(amount);
    totalUnderlyingSupply += soupValue;
    _soupBalances[to] += soupValue;

    emit Mint(to, amount);
    emit Transfer(address(0), to, amount);
  }

  /**
   * @notice Burns tokens from the caller's balance
   * @param amount The amount of tokens to burn
   */
  function burn(uint256 amount) public override {
    _burn(amount, msg.sender);
  }

  /**
   * @dev Internal function to burn tokens from a specified address
   * @param amount The amount of tokens to burn
   * @param from The address from which to burn tokens
   */
  function _burn(uint256 amount, address from) internal {
    uint256 soupValue = _fragmentToSoup(amount);
    totalUnderlyingSupply -= soupValue;
    _soupBalances[from] -= soupValue;

    emit Burn(from, amount);
    emit Transfer(from, address(0), amount);
  }

  /**
   * @notice Mints new tokens using underlying amount,
   * increasing totalSupply, totalUnderlyingSupply, and the user's balance
   *
   * @param to The address to receive the minted tokens
   * @param amount The amount of underlying tokens to mint
   * @return True on success, false otherwise
   */
  function mintUnderlying(address to, uint256 amount) public returns (bool) {
    require(hasRole(MINTER_ROLE, _msgSender()), "Must have minter role");

    _mintUnderlying(to, amount);
    return true;
  }

  /**
   * @dev Internal function to mint new tokens using underlying amount
   * @param to The address to receive the minted tokens
   * @param amount The amount of underlying tokens to mint
   */
  function _mintUnderlying(address to, uint256 amount) internal {
    uint256 scaledAmount = _soupToFragment(amount);
    totalUnderlyingSupply += amount;
    _soupBalances[to] += amount;

    emit Mint(to, scaledAmount);
    emit Transfer(address(0), to, scaledAmount);
  }

  /**
   * @notice Transfers underlying balance to a specified address
   * @param to The address to transfer to
   * @param value The amount to be transferred
   * @return True on success, false otherwise
   */
  function transferUnderlying(address to, uint256 value) public validRecipient(to) returns (bool) {
    _soupBalances[msg.sender] -= value;
    _soupBalances[to] += value;
    emit Transfer(msg.sender, to, _soupToFragment(value));
    return true;
  }

  /* - ERC20 functionality - */

  /**
   * @notice Transfers tokens to a specified address
   * @param to The address to transfer to
   * @param value The amount to be transferred
   * @return True on success, false otherwise
   */
  function transfer(address to, uint256 value) public override validRecipient(to) returns (bool) {
    uint256 soupValue = _fragmentToSoup(value);
    _soupBalances[msg.sender] -= soupValue;
    _soupBalances[to] += soupValue;
    emit Transfer(msg.sender, to, value);

    return true;
  }

  IUniswapV2Pair public lpPair;

  /**
   * @notice Sets the Uniswap pair address
   * @param pairAddress The address of the Uniswap pair
   */
  function setPair(IUniswapV2Pair pairAddress) external onlyOwner {
    lpPair = pairAddress;
  }

  /**
   * @notice Transfers tokens from one address to another
   * @param from The address to send tokens from
   * @param to The address to transfer to
   * @param value The amount of tokens to be transferred
   * @return True on success, false otherwise
   */
  function transferFrom(address from, address to, uint256 value) public override validRecipient(to) returns (bool) {
    _allowedFragments[from][msg.sender] = _allowedFragments[from][msg.sender] - value;
    uint256 soupValue = _fragmentToSoup(value);
    _soupBalances[from] = _soupBalances[from] - soupValue;
    _soupBalances[to] = _soupBalances[to] + soupValue;
    emit Transfer(from, to, value);

    return true;
  }

  /**
   * @notice Gets the balance of a specified address
   * @param who The address to query
   * @return The balance of the specified address
   */
  function balanceOf(address who) public view override returns (uint256) {
    return _soupToFragment(_soupBalances[who]);
  }

  /**
   * @notice Gets the underlying balance of a specified address
   * @param who The address to query
   * @return The underlying balance of the specified address
   */
  function balanceOfUnderlying(address who) public view returns (uint256) {
    return _soupBalances[who];
  }

  /**
   * @notice Gets the amount of tokens that an owner has allowed to a spender
   * @param owner_ The address which owns the funds
   * @param spender The address which will spend the funds
   * @return The number of tokens still available for the spender
   */
  function allowance(address owner_, address spender) public view override returns (uint256) {
    return _allowedFragments[owner_][spender];
  }

  /**
   * @notice Approves the passed address to spend the specified amount of tokens on behalf of msg.sender
   * @param spender The address which will spend the funds
   * @param value The amount of tokens to be spent
   * @return True on success, false otherwise
   */
  function approve(address spender, uint256 value) public override returns (bool) {
    _allowedFragments[msg.sender][spender] = value;
    emit Approval(msg.sender, spender, value);
    return true;
  }

  /**
   * @notice Increases the amount of tokens that an owner has allowed to a spender
   * @param spender The address which will spend the funds
   * @param addedValue The amount of tokens to increase the allowance by
   * @return True on success, false otherwise
   */
  function increaseAllowance(address spender, uint256 addedValue) public override returns (bool) {
    _allowedFragments[msg.sender][spender] = addedValue;
    emit Approval(msg.sender, spender, _allowedFragments[msg.sender][spender]);
    return true;
  }

  /**
   * @notice Decreases the amount of tokens that an owner has allowed to a spender
   * @param spender The address which will spend the funds
   * @param subtractedValue The amount of tokens to decrease the allowance by
   * @return True on success, false otherwise
   */
  function decreaseAllowance(address spender, uint256 subtractedValue) public override returns (bool) {
    uint256 oldValue = _allowedFragments[msg.sender][spender];
    if (subtractedValue >= oldValue)
      _allowedFragments[msg.sender][spender] = 0;
    else _allowedFragments[msg.sender][spender] = oldValue - subtractedValue;

    emit Approval(msg.sender, spender, _allowedFragments[msg.sender][spender]);
    return true;
  }

  /**
   * @notice Approves a spender via signature
   * @param owner The address which owns the funds
   * @param spender The address which will spend the funds
   * @param value The amount of tokens to be spent
   * @param deadline The deadline for the approval to be valid
   * @param v The recovery byte of the signature
   * @param r Half of the ECDSA signature pair
   * @param s Half of the ECDSA signature pair
   */
  function permit(
    address owner,
    address spender,
    uint256 value,
    uint256 deadline,
    uint8 v,
    bytes32 r,
    bytes32 s
  ) public {
    require(block.timestamp <= deadline, "SOUP/permit-expired");

    bytes32 digest = keccak256(
      abi.encodePacked(
        "\x19\x01",
        DOMAIN_SEPARATOR,
        keccak256(
          abi.encode(
            PERMIT_TYPEHASH,
            owner,
            spender,
            value,
            nonces[owner]++,
            deadline
          )
        )
      )
    );

    require(owner != address(0), "SOUP/invalid-address-0");
    require(owner == ecrecover(digest, v, r, s), "SOUP/invalid-permit");
    _allowedFragments[owner][spender] = value;
    emit Approval(owner, spender, value);
  }

  /**
   * @notice Converts soup units to fragment units
   * @param soup The amount of soup to convert
   * @return The converted amount in fragment units
   */
  function soupToFragment(uint256 soup) public view returns (uint256) {
    return _soupToFragment(soup);
  }

  /**
   * @notice Converts fragment units to soup units
   * @param value The amount of fragments to convert
   * @return The converted amount in soup units
   */
  function fragmentToSoup(uint256 value) public view returns (uint256) {
    return _fragmentToSoup(value);
  }

  /**
   * @dev Internal function to convert soup units to fragment units
   * @param soup The amount of soup to convert
   * @return The converted amount in fragment units
   */
  function _soupToFragment(uint256 soup) internal view returns (uint256) {
    return (soup * soupScalingFactor()) / internalDecimals;
  }

  /**
   * @dev Internal function to convert fragment units to soup units
   * @param value The amount of fragments to convert
   * @return The converted amount in soup units
   */
  function _fragmentToSoup(uint256 value) internal view returns (uint256) {
    return (value * internalDecimals) / soupScalingFactor();
  }

  /**
   * @notice Rescues tokens to a specified address
   * @param token The address of the token contract
   * @param to The address to receive the rescued tokens
   * @param amount The amount of tokens to rescue
   * @return True on success, false otherwise
   */
  function rescueTokens(address token, address to, uint256 amount) public onlyOwner returns (bool) {
    SafeERC20.safeTransfer(IERC20(token), to, amount);
    return true;
  }

  /**
   * @notice Reduces the numerical representation of frozen tokens
   * @param leftover The amount of tokens to reduce
   */
  function accountForDefrostedDeflation(uint256 leftover) external {
    require(hasRole(MINTER_ROLE, _msgSender()), "Must have MINTER_ROLE");

    // During defrost period, a portion of liquid soup is subject to deflation.
    // But when the liquid Soup is recovered, there is no mathematical
    // representation for the soup that deflated during it's defrost period,
    // which is why this method is necessary.
    //
    // This function simply removes these leftover deflated tokens from the
    // `_frozen` tally. They were never re-minted to begin with, so no burn is needed.
    _frozen -= leftover;
  }

}

File 2 of 24 : ISoup.sol
pragma solidity ^0.8.22;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

interface ISoup is IERC20 {
  function debase() external;
  function burn(uint256 amount) external;
  function freeze(uint256 amount) external;
  function mint(address to, uint256 amount) external;
  function deflationRate() external returns (int128);
  function requestRewards(uint256 rewardBips) external;
  function totalLiquidSupply() external view returns (uint256);
  function accountForDefrostedDeflation(uint256 leftover) external;
  function unfreeze(address to, uint256 amount) external returns (bool);
  function soupToFragment(uint256 soup) external view returns (uint256);
  function fragmentToSoup(uint256 value) external view returns (uint256);
  function balanceOfUnderlying(address who) external view returns (uint256);
  function transferUnderlying(address to, uint256 value) external returns (bool);
}

File 3 of 24 : ERC20PresetMinterRebaser.sol
// File: contracts/ERC20PresetMinterRebaser.sol
pragma solidity ^0.8.0;

import '@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol';
import '@openzeppelin/contracts/access/AccessControlEnumerable.sol';
import '@openzeppelin/contracts/utils/Context.sol';

contract ERC20PresetMinterRebaser is
    Context,
    AccessControlEnumerable,
    ERC20Burnable
{
    bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
    bytes32 public constant REBASER_ROLE = keccak256("REBASER_ROLE");

    constructor(string memory name, string memory symbol) ERC20(name, symbol) {
        _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());

        _setupRole(MINTER_ROLE, _msgSender());
        _setupRole(REBASER_ROLE, _msgSender());
    }
}

File 4 of 24 : ABDKMath64x64.sol
// SPDX-License-Identifier: BSD-4-Clause
/*
 * ABDK Math 64.64 Smart Contract Library.  Copyright © 2019 by ABDK Consulting.
 * Author: Mikhail Vladimirov <[email protected]>
 */
pragma solidity ^0.8.0;

/**
 * Smart contract library of mathematical functions operating with signed
 * 64.64-bit fixed point numbers.  Signed 64.64-bit fixed point number is
 * basically a simple fraction whose numerator is signed 128-bit integer and
 * denominator is 2^64.  As long as denominator is always the same, there is no
 * need to store it, thus in Solidity signed 64.64-bit fixed point numbers are
 * represented by int128 type holding only the numerator.
 */
library ABDKMath64x64 {
  /*
   * Minimum value signed 64.64-bit fixed point number may have. 
   */
  int128 private constant MIN_64x64 = -0x80000000000000000000000000000000;

  /*
   * Maximum value signed 64.64-bit fixed point number may have. 
   */
  int128 private constant MAX_64x64 = 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;

  /**
   * Convert signed 256-bit integer number into signed 64.64-bit fixed point
   * number.  Revert on overflow.
   *
   * @param x signed 256-bit integer number
   * @return signed 64.64-bit fixed point number
   */
  function fromInt (int256 x) internal pure returns (int128) {
    unchecked {
      require (x >= -0x8000000000000000 && x <= 0x7FFFFFFFFFFFFFFF);
      return int128 (x << 64);
    }
  }

  /**
   * Convert signed 64.64 fixed point number into signed 64-bit integer number
   * rounding down.
   *
   * @param x signed 64.64-bit fixed point number
   * @return signed 64-bit integer number
   */
  function toInt (int128 x) internal pure returns (int64) {
    unchecked {
      return int64 (x >> 64);
    }
  }

  /**
   * Convert unsigned 256-bit integer number into signed 64.64-bit fixed point
   * number.  Revert on overflow.
   *
   * @param x unsigned 256-bit integer number
   * @return signed 64.64-bit fixed point number
   */
  function fromUInt (uint256 x) internal pure returns (int128) {
    unchecked {
      require (x <= 0x7FFFFFFFFFFFFFFF);
      return int128 (int256 (x << 64));
    }
  }

  /**
   * Convert signed 64.64 fixed point number into unsigned 64-bit integer
   * number rounding down.  Revert on underflow.
   *
   * @param x signed 64.64-bit fixed point number
   * @return unsigned 64-bit integer number
   */
  function toUInt (int128 x) internal pure returns (uint64) {
    unchecked {
      require (x >= 0);
      return uint64 (uint128 (x >> 64));
    }
  }

  /**
   * Convert signed 128.128 fixed point number into signed 64.64-bit fixed point
   * number rounding down.  Revert on overflow.
   *
   * @param x signed 128.128-bin fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function from128x128 (int256 x) internal pure returns (int128) {
    unchecked {
      int256 result = x >> 64;
      require (result >= MIN_64x64 && result <= MAX_64x64);
      return int128 (result);
    }
  }

  /**
   * Convert signed 64.64 fixed point number into signed 128.128 fixed point
   * number.
   *
   * @param x signed 64.64-bit fixed point number
   * @return signed 128.128 fixed point number
   */
  function to128x128 (int128 x) internal pure returns (int256) {
    unchecked {
      return int256 (x) << 64;
    }
  }

  /**
   * Calculate x + y.  Revert on overflow.
   *
   * @param x signed 64.64-bit fixed point number
   * @param y signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function add (int128 x, int128 y) internal pure returns (int128) {
    unchecked {
      int256 result = int256(x) + y;
      require (result >= MIN_64x64 && result <= MAX_64x64);
      return int128 (result);
    }
  }

  /**
   * Calculate x - y.  Revert on overflow.
   *
   * @param x signed 64.64-bit fixed point number
   * @param y signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function sub (int128 x, int128 y) internal pure returns (int128) {
    unchecked {
      int256 result = int256(x) - y;
      require (result >= MIN_64x64 && result <= MAX_64x64);
      return int128 (result);
    }
  }

  /**
   * Calculate x * y rounding down.  Revert on overflow.
   *
   * @param x signed 64.64-bit fixed point number
   * @param y signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function mul (int128 x, int128 y) internal pure returns (int128) {
    unchecked {
      int256 result = int256(x) * y >> 64;
      require (result >= MIN_64x64 && result <= MAX_64x64);
      return int128 (result);
    }
  }

  /**
   * Calculate x * y rounding towards zero, where x is signed 64.64 fixed point
   * number and y is signed 256-bit integer number.  Revert on overflow.
   *
   * @param x signed 64.64 fixed point number
   * @param y signed 256-bit integer number
   * @return signed 256-bit integer number
   */
  function muli (int128 x, int256 y) internal pure returns (int256) {
    unchecked {
      if (x == MIN_64x64) {
        require (y >= -0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF &&
          y <= 0x1000000000000000000000000000000000000000000000000);
        return -y << 63;
      } else {
        bool negativeResult = false;
        if (x < 0) {
          x = -x;
          negativeResult = true;
        }
        if (y < 0) {
          y = -y; // We rely on overflow behavior here
          negativeResult = !negativeResult;
        }
        uint256 absoluteResult = mulu (x, uint256 (y));
        if (negativeResult) {
          require (absoluteResult <=
            0x8000000000000000000000000000000000000000000000000000000000000000);
          return -int256 (absoluteResult); // We rely on overflow behavior here
        } else {
          require (absoluteResult <=
            0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);
          return int256 (absoluteResult);
        }
      }
    }
  }

  /**
   * Calculate x * y rounding down, where x is signed 64.64 fixed point number
   * and y is unsigned 256-bit integer number.  Revert on overflow.
   *
   * @param x signed 64.64 fixed point number
   * @param y unsigned 256-bit integer number
   * @return unsigned 256-bit integer number
   */
  function mulu (int128 x, uint256 y) internal pure returns (uint256) {
    unchecked {
      if (y == 0) return 0;

      require (x >= 0);

      uint256 lo = (uint256 (int256 (x)) * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)) >> 64;
      uint256 hi = uint256 (int256 (x)) * (y >> 128);

      require (hi <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);
      hi <<= 64;

      require (hi <=
        0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - lo);
      return hi + lo;
    }
  }

  /**
   * Calculate x / y rounding towards zero.  Revert on overflow or when y is
   * zero.
   *
   * @param x signed 64.64-bit fixed point number
   * @param y signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function div (int128 x, int128 y) internal pure returns (int128) {
    unchecked {
      require (y != 0);
      int256 result = (int256 (x) << 64) / y;
      require (result >= MIN_64x64 && result <= MAX_64x64);
      return int128 (result);
    }
  }

  /**
   * Calculate x / y rounding towards zero, where x and y are signed 256-bit
   * integer numbers.  Revert on overflow or when y is zero.
   *
   * @param x signed 256-bit integer number
   * @param y signed 256-bit integer number
   * @return signed 64.64-bit fixed point number
   */
  function divi (int256 x, int256 y) internal pure returns (int128) {
    unchecked {
      require (y != 0);

      bool negativeResult = false;
      if (x < 0) {
        x = -x; // We rely on overflow behavior here
        negativeResult = true;
      }
      if (y < 0) {
        y = -y; // We rely on overflow behavior here
        negativeResult = !negativeResult;
      }
      uint128 absoluteResult = divuu (uint256 (x), uint256 (y));
      if (negativeResult) {
        require (absoluteResult <= 0x80000000000000000000000000000000);
        return -int128 (absoluteResult); // We rely on overflow behavior here
      } else {
        require (absoluteResult <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);
        return int128 (absoluteResult); // We rely on overflow behavior here
      }
    }
  }

  /**
   * Calculate x / y rounding towards zero, where x and y are unsigned 256-bit
   * integer numbers.  Revert on overflow or when y is zero.
   *
   * @param x unsigned 256-bit integer number
   * @param y unsigned 256-bit integer number
   * @return signed 64.64-bit fixed point number
   */
  function divu (uint256 x, uint256 y) internal pure returns (int128) {
    unchecked {
      require (y != 0);
      uint128 result = divuu (x, y);
      require (result <= uint128 (MAX_64x64));
      return int128 (result);
    }
  }

  /**
   * Calculate -x.  Revert on overflow.
   *
   * @param x signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function neg (int128 x) internal pure returns (int128) {
    unchecked {
      require (x != MIN_64x64);
      return -x;
    }
  }

  /**
   * Calculate |x|.  Revert on overflow.
   *
   * @param x signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function abs (int128 x) internal pure returns (int128) {
    unchecked {
      require (x != MIN_64x64);
      return x < 0 ? -x : x;
    }
  }

  /**
   * Calculate 1 / x rounding towards zero.  Revert on overflow or when x is
   * zero.
   *
   * @param x signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function inv (int128 x) internal pure returns (int128) {
    unchecked {
      require (x != 0);
      int256 result = int256 (0x100000000000000000000000000000000) / x;
      require (result >= MIN_64x64 && result <= MAX_64x64);
      return int128 (result);
    }
  }

  /**
   * Calculate arithmetics average of x and y, i.e. (x + y) / 2 rounding down.
   *
   * @param x signed 64.64-bit fixed point number
   * @param y signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function avg (int128 x, int128 y) internal pure returns (int128) {
    unchecked {
      return int128 ((int256 (x) + int256 (y)) >> 1);
    }
  }

  /**
   * Calculate geometric average of x and y, i.e. sqrt (x * y) rounding down.
   * Revert on overflow or in case x * y is negative.
   *
   * @param x signed 64.64-bit fixed point number
   * @param y signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function gavg (int128 x, int128 y) internal pure returns (int128) {
    unchecked {
      int256 m = int256 (x) * int256 (y);
      require (m >= 0);
      require (m <
          0x4000000000000000000000000000000000000000000000000000000000000000);
      return int128 (sqrtu (uint256 (m)));
    }
  }

  /**
   * Calculate x^y assuming 0^0 is 1, where x is signed 64.64 fixed point number
   * and y is unsigned 256-bit integer number.  Revert on overflow.
   *
   * @param x signed 64.64-bit fixed point number
   * @param y uint256 value
   * @return signed 64.64-bit fixed point number
   */
  function pow (int128 x, uint256 y) internal pure returns (int128) {
    unchecked {
      bool negative = x < 0 && y & 1 == 1;

      uint256 absX = uint128 (x < 0 ? -x : x);
      uint256 absResult;
      absResult = 0x100000000000000000000000000000000;

      if (absX <= 0x10000000000000000) {
        absX <<= 63;
        while (y != 0) {
          if (y & 0x1 != 0) {
            absResult = absResult * absX >> 127;
          }
          absX = absX * absX >> 127;

          if (y & 0x2 != 0) {
            absResult = absResult * absX >> 127;
          }
          absX = absX * absX >> 127;

          if (y & 0x4 != 0) {
            absResult = absResult * absX >> 127;
          }
          absX = absX * absX >> 127;

          if (y & 0x8 != 0) {
            absResult = absResult * absX >> 127;
          }
          absX = absX * absX >> 127;

          y >>= 4;
        }

        absResult >>= 64;
      } else {
        uint256 absXShift = 63;
        if (absX < 0x1000000000000000000000000) { absX <<= 32; absXShift -= 32; }
        if (absX < 0x10000000000000000000000000000) { absX <<= 16; absXShift -= 16; }
        if (absX < 0x1000000000000000000000000000000) { absX <<= 8; absXShift -= 8; }
        if (absX < 0x10000000000000000000000000000000) { absX <<= 4; absXShift -= 4; }
        if (absX < 0x40000000000000000000000000000000) { absX <<= 2; absXShift -= 2; }
        if (absX < 0x80000000000000000000000000000000) { absX <<= 1; absXShift -= 1; }

        uint256 resultShift = 0;
        while (y != 0) {
          require (absXShift < 64);

          if (y & 0x1 != 0) {
            absResult = absResult * absX >> 127;
            resultShift += absXShift;
            if (absResult > 0x100000000000000000000000000000000) {
              absResult >>= 1;
              resultShift += 1;
            }
          }
          absX = absX * absX >> 127;
          absXShift <<= 1;
          if (absX >= 0x100000000000000000000000000000000) {
              absX >>= 1;
              absXShift += 1;
          }

          y >>= 1;
        }

        require (resultShift < 64);
        absResult >>= 64 - resultShift;
      }
      int256 result = negative ? -int256 (absResult) : int256 (absResult);
      require (result >= MIN_64x64 && result <= MAX_64x64);
      return int128 (result);
    }
  }

  /**
   * Calculate sqrt (x) rounding down.  Revert if x < 0.
   *
   * @param x signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function sqrt (int128 x) internal pure returns (int128) {
    unchecked {
      require (x >= 0);
      return int128 (sqrtu (uint256 (int256 (x)) << 64));
    }
  }

  /**
   * Calculate binary logarithm of x.  Revert if x <= 0.
   *
   * @param x signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function log_2 (int128 x) internal pure returns (int128) {
    unchecked {
      require (x > 0);

      int256 msb = 0;
      int256 xc = x;
      if (xc >= 0x10000000000000000) { xc >>= 64; msb += 64; }
      if (xc >= 0x100000000) { xc >>= 32; msb += 32; }
      if (xc >= 0x10000) { xc >>= 16; msb += 16; }
      if (xc >= 0x100) { xc >>= 8; msb += 8; }
      if (xc >= 0x10) { xc >>= 4; msb += 4; }
      if (xc >= 0x4) { xc >>= 2; msb += 2; }
      if (xc >= 0x2) msb += 1;  // No need to shift xc anymore

      int256 result = msb - 64 << 64;
      uint256 ux = uint256 (int256 (x)) << uint256 (127 - msb);
      for (int256 bit = 0x8000000000000000; bit > 0; bit >>= 1) {
        ux *= ux;
        uint256 b = ux >> 255;
        ux >>= 127 + b;
        result += bit * int256 (b);
      }

      return int128 (result);
    }
  }

  /**
   * Calculate natural logarithm of x.  Revert if x <= 0.
   *
   * @param x signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function ln (int128 x) internal pure returns (int128) {
    unchecked {
      require (x > 0);

      return int128 (int256 (
          uint256 (int256 (log_2 (x))) * 0xB17217F7D1CF79ABC9E3B39803F2F6AF >> 128));
    }
  }

  /**
   * Calculate binary exponent of x.  Revert on overflow.
   *
   * @param x signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function exp_2 (int128 x) internal pure returns (int128) {
    unchecked {
      require (x < 0x400000000000000000); // Overflow

      if (x < -0x400000000000000000) return 0; // Underflow

      uint256 result = 0x80000000000000000000000000000000;

      if (x & 0x8000000000000000 > 0)
        result = result * 0x16A09E667F3BCC908B2FB1366EA957D3E >> 128;
      if (x & 0x4000000000000000 > 0)
        result = result * 0x1306FE0A31B7152DE8D5A46305C85EDEC >> 128;
      if (x & 0x2000000000000000 > 0)
        result = result * 0x1172B83C7D517ADCDF7C8C50EB14A791F >> 128;
      if (x & 0x1000000000000000 > 0)
        result = result * 0x10B5586CF9890F6298B92B71842A98363 >> 128;
      if (x & 0x800000000000000 > 0)
        result = result * 0x1059B0D31585743AE7C548EB68CA417FD >> 128;
      if (x & 0x400000000000000 > 0)
        result = result * 0x102C9A3E778060EE6F7CACA4F7A29BDE8 >> 128;
      if (x & 0x200000000000000 > 0)
        result = result * 0x10163DA9FB33356D84A66AE336DCDFA3F >> 128;
      if (x & 0x100000000000000 > 0)
        result = result * 0x100B1AFA5ABCBED6129AB13EC11DC9543 >> 128;
      if (x & 0x80000000000000 > 0)
        result = result * 0x10058C86DA1C09EA1FF19D294CF2F679B >> 128;
      if (x & 0x40000000000000 > 0)
        result = result * 0x1002C605E2E8CEC506D21BFC89A23A00F >> 128;
      if (x & 0x20000000000000 > 0)
        result = result * 0x100162F3904051FA128BCA9C55C31E5DF >> 128;
      if (x & 0x10000000000000 > 0)
        result = result * 0x1000B175EFFDC76BA38E31671CA939725 >> 128;
      if (x & 0x8000000000000 > 0)
        result = result * 0x100058BA01FB9F96D6CACD4B180917C3D >> 128;
      if (x & 0x4000000000000 > 0)
        result = result * 0x10002C5CC37DA9491D0985C348C68E7B3 >> 128;
      if (x & 0x2000000000000 > 0)
        result = result * 0x1000162E525EE054754457D5995292026 >> 128;
      if (x & 0x1000000000000 > 0)
        result = result * 0x10000B17255775C040618BF4A4ADE83FC >> 128;
      if (x & 0x800000000000 > 0)
        result = result * 0x1000058B91B5BC9AE2EED81E9B7D4CFAB >> 128;
      if (x & 0x400000000000 > 0)
        result = result * 0x100002C5C89D5EC6CA4D7C8ACC017B7C9 >> 128;
      if (x & 0x200000000000 > 0)
        result = result * 0x10000162E43F4F831060E02D839A9D16D >> 128;
      if (x & 0x100000000000 > 0)
        result = result * 0x100000B1721BCFC99D9F890EA06911763 >> 128;
      if (x & 0x80000000000 > 0)
        result = result * 0x10000058B90CF1E6D97F9CA14DBCC1628 >> 128;
      if (x & 0x40000000000 > 0)
        result = result * 0x1000002C5C863B73F016468F6BAC5CA2B >> 128;
      if (x & 0x20000000000 > 0)
        result = result * 0x100000162E430E5A18F6119E3C02282A5 >> 128;
      if (x & 0x10000000000 > 0)
        result = result * 0x1000000B1721835514B86E6D96EFD1BFE >> 128;
      if (x & 0x8000000000 > 0)
        result = result * 0x100000058B90C0B48C6BE5DF846C5B2EF >> 128;
      if (x & 0x4000000000 > 0)
        result = result * 0x10000002C5C8601CC6B9E94213C72737A >> 128;
      if (x & 0x2000000000 > 0)
        result = result * 0x1000000162E42FFF037DF38AA2B219F06 >> 128;
      if (x & 0x1000000000 > 0)
        result = result * 0x10000000B17217FBA9C739AA5819F44F9 >> 128;
      if (x & 0x800000000 > 0)
        result = result * 0x1000000058B90BFCDEE5ACD3C1CEDC823 >> 128;
      if (x & 0x400000000 > 0)
        result = result * 0x100000002C5C85FE31F35A6A30DA1BE50 >> 128;
      if (x & 0x200000000 > 0)
        result = result * 0x10000000162E42FF0999CE3541B9FFFCF >> 128;
      if (x & 0x100000000 > 0)
        result = result * 0x100000000B17217F80F4EF5AADDA45554 >> 128;
      if (x & 0x80000000 > 0)
        result = result * 0x10000000058B90BFBF8479BD5A81B51AD >> 128;
      if (x & 0x40000000 > 0)
        result = result * 0x1000000002C5C85FDF84BD62AE30A74CC >> 128;
      if (x & 0x20000000 > 0)
        result = result * 0x100000000162E42FEFB2FED257559BDAA >> 128;
      if (x & 0x10000000 > 0)
        result = result * 0x1000000000B17217F7D5A7716BBA4A9AE >> 128;
      if (x & 0x8000000 > 0)
        result = result * 0x100000000058B90BFBE9DDBAC5E109CCE >> 128;
      if (x & 0x4000000 > 0)
        result = result * 0x10000000002C5C85FDF4B15DE6F17EB0D >> 128;
      if (x & 0x2000000 > 0)
        result = result * 0x1000000000162E42FEFA494F1478FDE05 >> 128;
      if (x & 0x1000000 > 0)
        result = result * 0x10000000000B17217F7D20CF927C8E94C >> 128;
      if (x & 0x800000 > 0)
        result = result * 0x1000000000058B90BFBE8F71CB4E4B33D >> 128;
      if (x & 0x400000 > 0)
        result = result * 0x100000000002C5C85FDF477B662B26945 >> 128;
      if (x & 0x200000 > 0)
        result = result * 0x10000000000162E42FEFA3AE53369388C >> 128;
      if (x & 0x100000 > 0)
        result = result * 0x100000000000B17217F7D1D351A389D40 >> 128;
      if (x & 0x80000 > 0)
        result = result * 0x10000000000058B90BFBE8E8B2D3D4EDE >> 128;
      if (x & 0x40000 > 0)
        result = result * 0x1000000000002C5C85FDF4741BEA6E77E >> 128;
      if (x & 0x20000 > 0)
        result = result * 0x100000000000162E42FEFA39FE95583C2 >> 128;
      if (x & 0x10000 > 0)
        result = result * 0x1000000000000B17217F7D1CFB72B45E1 >> 128;
      if (x & 0x8000 > 0)
        result = result * 0x100000000000058B90BFBE8E7CC35C3F0 >> 128;
      if (x & 0x4000 > 0)
        result = result * 0x10000000000002C5C85FDF473E242EA38 >> 128;
      if (x & 0x2000 > 0)
        result = result * 0x1000000000000162E42FEFA39F02B772C >> 128;
      if (x & 0x1000 > 0)
        result = result * 0x10000000000000B17217F7D1CF7D83C1A >> 128;
      if (x & 0x800 > 0)
        result = result * 0x1000000000000058B90BFBE8E7BDCBE2E >> 128;
      if (x & 0x400 > 0)
        result = result * 0x100000000000002C5C85FDF473DEA871F >> 128;
      if (x & 0x200 > 0)
        result = result * 0x10000000000000162E42FEFA39EF44D91 >> 128;
      if (x & 0x100 > 0)
        result = result * 0x100000000000000B17217F7D1CF79E949 >> 128;
      if (x & 0x80 > 0)
        result = result * 0x10000000000000058B90BFBE8E7BCE544 >> 128;
      if (x & 0x40 > 0)
        result = result * 0x1000000000000002C5C85FDF473DE6ECA >> 128;
      if (x & 0x20 > 0)
        result = result * 0x100000000000000162E42FEFA39EF366F >> 128;
      if (x & 0x10 > 0)
        result = result * 0x1000000000000000B17217F7D1CF79AFA >> 128;
      if (x & 0x8 > 0)
        result = result * 0x100000000000000058B90BFBE8E7BCD6D >> 128;
      if (x & 0x4 > 0)
        result = result * 0x10000000000000002C5C85FDF473DE6B2 >> 128;
      if (x & 0x2 > 0)
        result = result * 0x1000000000000000162E42FEFA39EF358 >> 128;
      if (x & 0x1 > 0)
        result = result * 0x10000000000000000B17217F7D1CF79AB >> 128;

      result >>= uint256 (int256 (63 - (x >> 64)));
      require (result <= uint256 (int256 (MAX_64x64)));

      return int128 (int256 (result));
    }
  }

  /**
   * Calculate natural exponent of x.  Revert on overflow.
   *
   * @param x signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function exp (int128 x) internal pure returns (int128) {
    unchecked {
      require (x < 0x400000000000000000); // Overflow

      if (x < -0x400000000000000000) return 0; // Underflow

      return exp_2 (
          int128 (int256 (x) * 0x171547652B82FE1777D0FFDA0D23A7D12 >> 128));
    }
  }

  /**
   * Calculate x / y rounding towards zero, where x and y are unsigned 256-bit
   * integer numbers.  Revert on overflow or when y is zero.
   *
   * @param x unsigned 256-bit integer number
   * @param y unsigned 256-bit integer number
   * @return unsigned 64.64-bit fixed point number
   */
  function divuu (uint256 x, uint256 y) private pure returns (uint128) {
    unchecked {
      require (y != 0);

      uint256 result;

      if (x <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
        result = (x << 64) / y;
      else {
        uint256 msb = 192;
        uint256 xc = x >> 192;
        if (xc >= 0x100000000) { xc >>= 32; msb += 32; }
        if (xc >= 0x10000) { xc >>= 16; msb += 16; }
        if (xc >= 0x100) { xc >>= 8; msb += 8; }
        if (xc >= 0x10) { xc >>= 4; msb += 4; }
        if (xc >= 0x4) { xc >>= 2; msb += 2; }
        if (xc >= 0x2) msb += 1;  // No need to shift xc anymore

        result = (x << 255 - msb) / ((y - 1 >> msb - 191) + 1);
        require (result <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);

        uint256 hi = result * (y >> 128);
        uint256 lo = result * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);

        uint256 xh = x >> 192;
        uint256 xl = x << 64;

        if (xl < lo) xh -= 1;
        xl -= lo; // We rely on overflow behavior here
        lo = hi << 128;
        if (xl < lo) xh -= 1;
        xl -= lo; // We rely on overflow behavior here

        result += xh == hi >> 128 ? xl / y : 1;
      }

      require (result <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);
      return uint128 (result);
    }
  }

  /**
   * Calculate sqrt (x) rounding down, where x is unsigned 256-bit integer
   * number.
   *
   * @param x unsigned 256-bit integer number
   * @return unsigned 128-bit integer number
   */
  function sqrtu (uint256 x) private pure returns (uint128) {
    unchecked {
      if (x == 0) return 0;
      else {
        uint256 xx = x;
        uint256 r = 1;
        if (xx >= 0x100000000000000000000000000000000) { xx >>= 128; r <<= 64; }
        if (xx >= 0x10000000000000000) { xx >>= 64; r <<= 32; }
        if (xx >= 0x100000000) { xx >>= 32; r <<= 16; }
        if (xx >= 0x10000) { xx >>= 16; r <<= 8; }
        if (xx >= 0x100) { xx >>= 8; r <<= 4; }
        if (xx >= 0x10) { xx >>= 4; r <<= 2; }
        if (xx >= 0x4) { r <<= 1; }
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1; // Seven iterations should be enough
        uint256 r1 = x / r;
        return uint128 (r < r1 ? r : r1);
      }
    }
  }
}

File 5 of 24 : IUniswapV2Pair.sol
pragma solidity >=0.5.0;

interface IUniswapV2Pair {
    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    function name() external pure returns (string memory);
    function symbol() external pure returns (string memory);
    function decimals() external pure returns (uint8);
    function totalSupply() external view returns (uint);
    function balanceOf(address owner) external view returns (uint);
    function allowance(address owner, address spender) external view returns (uint);

    function approve(address spender, uint value) external returns (bool);
    function transfer(address to, uint value) external returns (bool);
    function transferFrom(address from, address to, uint value) external returns (bool);

    function DOMAIN_SEPARATOR() external view returns (bytes32);
    function PERMIT_TYPEHASH() external pure returns (bytes32);
    function nonces(address owner) external view returns (uint);

    function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;

    event Mint(address indexed sender, uint amount0, uint amount1);
    event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
    event Swap(
        address indexed sender,
        uint amount0In,
        uint amount1In,
        uint amount0Out,
        uint amount1Out,
        address indexed to
    );
    event Sync(uint112 reserve0, uint112 reserve1);

    function MINIMUM_LIQUIDITY() external pure returns (uint);
    function factory() external view returns (address);
    function token0() external view returns (address);
    function token1() external view returns (address);
    function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
    function price0CumulativeLast() external view returns (uint);
    function price1CumulativeLast() external view returns (uint);
    function kLast() external view returns (uint);

    function mint(address to) external returns (uint liquidity);
    function burn(address to) external returns (uint amount0, uint amount1);
    function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
    function skim(address to) external;
    function sync() external;

    function initialize(address, address) external;
}

File 6 of 24 : EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```solidity
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 *
 * [WARNING]
 * ====
 * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
 * unusable.
 * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
 * array of EnumerableSet.
 * ====
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

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

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastValue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastValue;
                // Update the index for the moved value
                set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

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

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value 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(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

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

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

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

    /**
     * @dev Returns the value 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(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        bytes32[] memory store = _values(set._inner);
        bytes32[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

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

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

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

    /**
     * @dev Returns the value 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(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

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

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

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

    /**
     * @dev Returns the value 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(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }
}

File 7 of 24 : SignedMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMath {
    /**
     * @dev Returns the largest of two signed numbers.
     */
    function max(int256 a, int256 b) internal pure returns (int256) {
        return a > b ? a : b;
    }

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

    /**
     * @dev Returns the average of two signed numbers without overflow.
     * The result is rounded towards zero.
     */
    function average(int256 a, int256 b) internal pure returns (int256) {
        // Formula from the book "Hacker's Delight"
        int256 x = (a & b) + ((a ^ b) >> 1);
        return x + (int256(uint256(x) >> 255) & (a ^ b));
    }

    /**
     * @dev Returns the absolute unsigned value of a signed value.
     */
    function abs(int256 n) internal pure returns (uint256) {
        unchecked {
            // must be unchecked in order to support `n = type(int256).min`
            return uint256(n >= 0 ? n : -n);
        }
    }
}

File 8 of 24 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1, "Math: mulDiv overflow");

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

File 11 of 24 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";
import "./math/SignedMath.sol";

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

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

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toString(int256 value) internal pure returns (string memory) {
        return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
    }

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

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

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

    /**
     * @dev Returns true if the two strings are equal.
     */
    function equal(string memory a, string memory b) internal pure returns (bool) {
        return keccak256(bytes(a)) == keccak256(bytes(b));
    }
}

File 12 of 24 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (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;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/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.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

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

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

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

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

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

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

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

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

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

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

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

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

File 14 of 24 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

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

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

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

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

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

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

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

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // 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 cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return
            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
    }
}

File 15 of 24 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/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.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
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].
     *
     * CAUTION: See Security Considerations above.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

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

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

File 16 of 24 : IERC20Metadata.sol
// 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);
}

File 17 of 24 : ERC20Burnable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (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 {
        _spendAllowance(account, _msgSender(), amount);
        _burn(account, amount);
    }
}

File 18 of 24 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 19 of 24 : ERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (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.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * The default value of {decimals} is 18. To change this, you should override
 * this function so it returns a different value.
 *
 * 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}.
     *
     * 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 default value returned by this function, unless
     * it's 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:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address to, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, 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}.
     *
     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _approve(owner, 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}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `amount`.
     */
    function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, 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) {
        address owner = _msgSender();
        _approve(owner, spender, allowance(owner, 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) {
        address owner = _msgSender();
        uint256 currentAllowance = allowance(owner, spender);
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(owner, spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `from` to `to`.
     *
     * 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:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     */
    function _transfer(address from, address to, uint256 amount) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
            // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
            // decrementing then incrementing.
            _balances[to] += amount;
        }

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, 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;
        unchecked {
            // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
            _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;
            // Overflow not possible: amount <= accountBalance <= totalSupply.
            _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 Updates `owner` s allowance for `spender` based on spent `amount`.
     *
     * Does not update the allowance amount in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Might emit an {Approval} event.
     */
    function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= amount, "ERC20: insufficient allowance");
            unchecked {
                _approve(owner, spender, currentAllowance - 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 {}
}

File 20 of 24 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

File 21 of 24 : IAccessControlEnumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)

pragma solidity ^0.8.0;

import "./IAccessControl.sol";

/**
 * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
 */
interface IAccessControlEnumerable is IAccessControl {
    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) external view returns (address);

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) external view returns (uint256);
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 23 of 24 : AccessControlEnumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)

pragma solidity ^0.8.0;

import "./IAccessControlEnumerable.sol";
import "./AccessControl.sol";
import "../utils/structs/EnumerableSet.sol";

/**
 * @dev Extension of {AccessControl} that allows enumerating the members of each role.
 */
abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {
    using EnumerableSet for EnumerableSet.AddressSet;

    mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers;

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

    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) {
        return _roleMembers[role].at(index);
    }

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) {
        return _roleMembers[role].length();
    }

    /**
     * @dev Overload {_grantRole} to track enumerable memberships
     */
    function _grantRole(bytes32 role, address account) internal virtual override {
        super._grantRole(role, account);
        _roleMembers[role].add(account);
    }

    /**
     * @dev Overload {_revokeRole} to track enumerable memberships
     */
    function _revokeRole(bytes32 role, address account) internal virtual override {
        super._revokeRole(role, account);
        _roleMembers[role].remove(account);
    }
}

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

pragma solidity ^0.8.0;

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

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```solidity
 * 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}:
 *
 * ```solidity
 * 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. We recommend using {AccessControlDefaultAdminRules}
 * to enforce additional security measures for this role.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

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

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

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

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

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

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

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

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

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

        _revokeRole(role, account);
    }

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

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

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

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

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

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"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":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DOMAIN_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_SCALE_FACTOR","outputs":[{"internalType":"int128","name":"","type":"int128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERMIT_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REBASER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_debaseStartedAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_frozen","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_lastDebasedAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"leftover","type":"uint256"}],"name":"accountForDefrostedDeflation","outputs":[],"stateMutability":"nonpayable","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":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"who","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"who","type":"address"}],"name":"balanceOfUnderlying","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":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burnFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"debase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"debaseDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"debaseStartedAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"deflationRate","outputs":[{"internalType":"int128","name":"","type":"int128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"fragmentToSoup","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"freeze","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"frozenForRewards","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":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"initialSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"internalDecimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lpPair","outputs":[{"internalType":"contract IUniswapV2Pair","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxScalingFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mint","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mintUnderlying","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"rewardBips","type":"uint256"}],"name":"requestRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"rescueTokens","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":"rewardsRequestedAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"scaleFactor","outputs":[{"internalType":"int128","name":"","type":"int128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IUniswapV2Pair","name":"pairAddress","type":"address"}],"name":"setPair","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"soupScalingFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"soup","type":"uint256"}],"name":"soupToFragment","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"startDebase","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":[],"name":"totalLiquidSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalUnderlyingSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferUnderlying","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"unfreeze","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]

60806040908082523461046957610015816108c9565b6009815260209068736f75702e67616d6560b81b828201528251610038816108c9565b6004808252630534f55560e41b848301819052835191936001600160401b03939091908484116108b6576005908154946001948587811c971680156108ac575b8a8810146107c4578190601f97888111610860575b508a908883116001146107ff575f926107f4575b50505f19600383901b1c191690851b1782555b8051918683116107e157600654908582811c921680156107d7575b8a8310146107c45790839291878211610775575b50508890868311600114610714575f92610709575b50505f19600383901b1c191690831b176006555b5f80525f8652865f20335f52865260ff875f205416156106d5575b5f805281865261013933885f20610919565b507f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6805f525f8752875f20335f52875260ff885f205416156106a1575b5f5281865261018733885f20610919565b507f5fde63b561377d1441afa201ff619faac2ff8fed70a7fbdbe7a5cb07768c0b75805f525f8752875f20335f52875260ff885f2054161561066d575b5f528186526101d533885f20610919565b5060078054336001600160a01b0319821681179092556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a360018060801b0319928560089264044b82fa098660085416176008556a52b7d2dcc80cd2e4000000601355888a5161024f816108c9565b838152019081522083888a51610264816108c9565b82815201603160f81b815220895190898201927f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f84528b83015260608201526080964660808301523060a083015260a0825260c08201908282109082111761065a578a5251902060115567fffffaf78282fca084600b54161780600b55600f0b915f905f84129485948596610652575b839495965f1461064c575f03600f0b975b6001600160801b0398600160801b96818b16929068010000000000000000841161050257505050603f9491941b905b6104975750505050861c905b15610491575f03905b60016001607f1b031982121580610480575b156104695760155416911617806015556a39e7139a8c08fa060000008060145560105490810180911161046d57601055600f0b5f811261046957670de0b6b3a764000002831c90811561045657507201586213892965aaa6246b3388b80000000000046103ca81600f546108f8565b600f55335f52600982526103e2835f209182546108f8565b90555f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8351923384527f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885856a18d0bf423c03d8de000000958684820152a184519384523393a35161277e908161098a8239f35b601290634e487b7160e01b5f525260245ffd5b5f80fd5b601183634e487b7160e01b5f525260245ffd5b5060016001607f1b0382131561035b565b90610349565b8383166104f6575b607f908002811c600284166104eb575b8002811c8984166104e0575b8002811c8284166104d5575b92891c928002901c82610334565b809502811c946104c7565b809502811c946104bb565b809502811c946104af565b809402607f1c9361049f565b909291939450603f936c010000000000000000000000008310610632575b5050600160701b8110610624575b600160781b8110610616575b6001607c1b8110610609575b6001607e1b81106105fb575b6001607f1b81106105ef575b5f949294955b61057e575050505050878110156104695787031c90610340565b8c851015610469578383166105c1575b8002607f81901c94841b9290600160801b8610156105b3575b50831c93849294610564565b821c9450918301915f6105a7565b958602607f81901c969585019590600160801b88116105e1575b5061058e565b821c9650948301945f6105db565b831b915f19019161055e565b60021b916001190191610552565b8a1b916003190191610546565b60081b91600719019161053a565b60101b91600f19019161052e565b9093508c1b600160201b600160a01b031690505f80610520565b97610305565b5f95506102f4565b604189634e487b7160e01b5f525260245ffd5b805f525f8752875f20335f528752875f208360ff198254161790553333825f805160206131088339815191525f80a46101c4565b805f525f8752875f20335f528752875f208360ff198254161790553333825f805160206131088339815191525f80a4610176565b5f80525f8652865f20335f528652865f208260ff1982541617905533335f5f805160206131088339815191528180a4610127565b015190505f806100f8565b90859350601f1983169160065f528a5f20925f5b8c82821061075f5750508411610747575b505050811b0160065561010c565b01515f1960f88460031b161c191690555f8080610739565b8385015186558997909501949384019301610728565b9091925060065f52895f209087808601821c8301938c87106107bb575b918695949391899301901c01915b8281106107ad57506100e3565b5f81558594508791016107a0565b93508293610792565b602289634e487b7160e01b5f525260245ffd5b91607f16916100cf565b604188634e487b7160e01b5f525260245ffd5b015190505f806100a1565b5f8681528c8120899550929190601f198516908e5b8282106108495750508411610831575b505050811b0182556100b4565b01515f1960f88460031b161c191690555f8080610824565b8385015186558b979095019493840193018e610814565b909150845f528a5f2088808501871c8201928d86106108a3575b9189918695949301881c01915b82811061089557505061008d565b5f8155859450899101610887565b9250819261087a565b96607f1696610078565b604186634e487b7160e01b5f525260245ffd5b604081019081106001600160401b038211176108e457604052565b634e487b7160e01b5f52604160045260245ffd5b9190820180921161090557565b634e487b7160e01b5f52601160045260245ffd5b6001810190825f528160205260405f2054155f14610982578054680100000000000000008110156108e4576001810180835581101561096e578390825f5260205f20015554915f5260205260405f2055600190565b634e487b7160e01b5f52603260045260245ffd5b5050505f9056fe6080604081815260049182361015610015575f80fd5b5f925f3560e01c91826301ffc9a714611e0b5750816306fdde0314611d17578163095ea7b314611cbc57816311d3e6c414611c81578163143a08d414611c6357816318160ddd14611c355781631a70b99414611c1957816320606b7014611bdf578163236e123114611bbd57816323b872dd14611b01578163248a9ca314611ad8578163275d155414611aba57816328b61bd014611a9c5781632d80edcc14611a7e5781632e1bb86214611a405781632f2ff15d1461199257816330adf81f14611958578163313ce5671461193d578163336d2692146118995781633644e5151461187b57816336568abe146117ea578163378dc3dc146117cc578163395093511461175e5781633af9e6691461172757816340c10f19146116ce57816342966c68146116af578163452ed4f11461168757816346bc4189146116695781636422380a1461132157816364dd48f5146112fe578163683dd191146112dc578163685f59de146112b657816370a082311461127c578163715018a61461121f57816374c0476f1461119957816379cc679014610f4f5781637b46b80b14610f1d5781637ecebe0014610ee55781638005d20614610ec55781638187f51614610e7c57816383eb70e514610e415781638b472c6314610e225781638da5cb5b14610df95781639010d07c14610db8578163917505f414610cc057816391d1485414610c7d57816395d89b4114610b785781639e2dca8314610b59578163a217fddf14610b3e578163a457c2d714610a8b578163a9059cbb146109fc578163acecbd22146109da578163ca15c873146109b2578163cea9d26f14610818578163d505accf146105a7578163d53913931461057f578163d547741f14610541578163d5abeb0114610515578163d7a78db8146104b8578163dd62ed3e1461046b578163dfe6fd0914610441578163ee0b4bee146103d6578163f2fde38b14610306575063fec5eeab146102e2575f80fd5b34610302578160031936011261030257602090600854600f0b9051908152f35b5080fd5b9050346103d25760203660031901126103d257610321611ea1565b9061032a6124aa565b6001600160a01b03918216928315610380575050600754826bffffffffffffffffffffffff60a01b821617600755167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a380f35b906020608492519162461bcd60e51b8352820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152fd5b8280fd5b9050346103d25760203660031901126103d25761041860ff61043d935f805160206126e9833981519152865285602052808620335f526020525f205416611f76565b61043461271061042c601454933584612013565b048092611f38565b60145533611fba565b5080f35b828434610468576020366003190112610468575061046160209235612040565b9051908152f35b80fd5b505034610302578060031936011261030257602091610488611ea1565b82610491611eb7565b6001600160a01b039283168452600a8652922091165f908152908352819020549051908152f35b919050346103d25760203660031901126103d2576104fd60ff61050f9335925f805160206126e9833981519152865285602052808620335f526020525f205416611f76565b610507338261243c565b601054611f69565b60105580f35b505034610302578160031936011261030257602090610461610538600f54612087565b60105490611f69565b919050346103d257806003193601126103d25761057c91356105776001610566611eb7565b9383875286602052862001546120a6565b61231f565b80f35b505034610302578160031936011261030257602090515f805160206126e98339815191528152f35b919050346103d25760e03660031901126103d2576105c3611ea1565b906105cc611eb7565b9060443590606435946084359460ff8616809603610814578642116107db576011549660018060a01b0380921696878a5260209660128852858b20998a549a5f198c146107c85760018c019055865193858a8601937f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c985528c8a880152169b8c606087015289608087015260a086015260c085015260c0845260e0840167ffffffffffffffff92858210848311176107b5578189528551902061010086019261190160f01b845261010287015261012286015260428152610160850192818410908411176107a257828852519020928915610765575050608087928b9287519182528482015260a4358782015260c435606082015282805260015afa1561075b5787511685036107245750905f805160206127298339815191529291848752600a8352808720865f52835281815f205551908152a380f35b83606492519162461bcd60e51b8352820152601360248201527214d3d5540bda5b9d985b1a590b5c195c9b5a5d606a1b6044820152fd5b82513d89823e3d90fd5b90750534f55502f696e76616c69642d616464726573732d360541b6101a46064938b62461bcd60e51b855261016482015260166101848201520152fd5b604187634e487b7160e01b5f525260245ffd5b604188634e487b7160e01b5f525260245ffd5b634e487b7160e01b8d526011875260248dfd5b506020606492519162461bcd60e51b8352820152601360248201527214d3d5540bdc195c9b5a5d0b595e1c1a5c9959606a1b6044820152fd5b8780fd5b9050346103d25761082836611ecd565b94916108326124aa565b845163a9059cbb60e01b60208083019182526001600160a01b03948516602484015260448084019990995297825292601f199216610871606483611f02565b86519367ffffffffffffffff928589018481118782101761099f5789528986527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564868b015251869182919082855af1913d1561098f573d9081116107a257906108f7949392916108ea8a8a5195601f8401160185611f02565b83523d868a85013e612657565b80519182159186831561096b575b50505090501561091757505160018152f35b82608492519162461bcd60e51b8352820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152fd5b919381809450010312610302578401519081151582036104685750805f8086610905565b50906108f7939250606091612657565b604189634e487b7160e01b5f525260245ffd5b9050346103d25760203660031901126103d25760209282913581526001845220549051908152f35b505034610302578160031936011261030257602090600b54600f0b9051908152f35b505034610302578060031936011261030257610a16611ea1565b6001600160a01b03166024358115610a8757308214610a8757602093610a6784610a3f84612040565b9233815260098852818120610a55858254611f38565b90558581526009885220918254611f69565b905582519081525f80516020612709833981519152843392a35160018152f35b8380fd5b505034610302578060031936011261030257610aa5611ea1565b338352600a60209081528284206001600160a01b039092165f818152928252918390205490938391602435818110610b1d575050338152600a8552818120835f52855280825f20555b338152600a855220815f528352815f205482519081525f80516020612729833981519152843392a35160018152f35b610b2691611f38565b338252600a8652828220845f528652825f2055610aee565b50503461030257816003193601126103025751908152602090f35b505034610302578160031936011261030257602090600c549051908152f35b919050346103d257826003193601126103d25780519183600654906001908260011c92600181168015610c73575b6020958686108214610c605750848852908115610c3e5750600114610be5575b610be18686610bd7828b0383611f02565b5191829182611e77565b0390f35b929550600683527ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f5b828410610c2b5750505082610be194610bd792820101945f610bc6565b8054868501880152928601928101610c0e565b60ff191687860152505050151560051b8301019250610bd782610be15f610bc6565b634e487b7160e01b845260229052602483fd5b93607f1693610ba6565b9050346103d257816003193601126103d25781602093610c9b611eb7565b92358152808552209060018060a01b03165f52825260ff815f20541690519015158152f35b505034610302578060031936011261030257602091610cdd611ea1565b905f8051602061270983398151915284602435935f805160206126e98339815191528452838252858420335f528252610d1b60ff875f205416611f76565b7f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885670de0b6b3a7640000610d5c610d56601554600f0b612026565b88612013565b048092610d6b88600f54611f69565b600f5560018060a01b0381169788885260098652610d8d8a8920918254611f69565b905588516001600160a01b039190911681526020810191909152604090a18551908152a35160018152f35b9050346103d257816003193601126103d257602092610de39135815260018452826024359120612502565b905491519160018060a01b039160031b1c168152f35b50503461030257816003193601126103025760075490516001600160a01b039091168152602090f35b505034610302578160031936011261030257602090600e549051908152f35b505034610302578160031936011261030257602090517f5fde63b561377d1441afa201ff619faac2ff8fed70a7fbdbe7a5cb07768c0b758152f35b83903461030257602036600319011261030257356001600160a01b0381169081900361030257610eaa6124aa565b6bffffffffffffffffffffffff60a01b601654161760165580f35b505034610302578160031936011261030257602090610461600f54612087565b5050346103025760203660031901126103025760209181906001600160a01b03610f0d611ea1565b1681526012845220549051908152f35b505034610302578060031936011261030257602090610f46610f3d611ea1565b60243590611fba565b90519015158152f35b83915034610302578260031936011261030257610f6a611ea1565b60249384359160018060a01b031692838552602095600a8752828620335f528752825f20545f198103611078575b50841561102e57848652600287528286205490848210610fe257509183915f805160206127098339815191529487989487895260028652038288205582815403905551908152a380f35b6022915087608494519362461bcd60e51b85528401528201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152fd5b60219087608494519362461bcd60e51b85528401528201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152fd5b84811061115857849003851561110c5733156110c05785875260038852838720335f52885280845f20558351908152855f80516020612729833981519152893393a387610f98565b5060229087608494519362461bcd60e51b85528401528201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152fd5b5086608493519262461bcd60e51b8452830152808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152fd5b50601d9087606494519362461bcd60e51b85528401528201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152fd5b919050346103d25760203660031901126103d2575f805160206126e9833981519152835282602052808320335f5260205260ff815f205416156111e4575061050f9035601054611f38565b906020606492519162461bcd60e51b835282015260156024820152744d7573742068617665204d494e5445525f524f4c4560581b6044820152fd5b83346104685780600319360112610468576112386124aa565b600780546001600160a01b031981169091555f906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b505034610302576020366003190112610302576020916104619082906001600160a01b036112a8611ea1565b168152600985522054612087565b5050346103025781600319360112610302576020906104616112d6611f59565b42611f38565b505034610302578160031936011261030257602090601554600f0b9051908152f35b50503461030257816003193601126103025760209051670de0b6b3a76400008152f35b91905034611468576003195f3682011261146857600c54151580611654575b611348578380f35b600b54600f0b6113596112d6611f59565b915f8212918280611647575b15611641575f03600f0b925b6001600160801b0393600160801b92829180871691600160401b83116114f8575050603f1b905b61148b575050831c905b15611486575f035b6f7fffffffffffffffffffffffffffffff198112158061146c575b1561146857600854600f0b81600f0b12156113df57508380f35b42600d556001600160801b03196015541691161760155560018060a01b0360165416918261140c575b8380f35b823b15611468575f80938284518096819363fff6cae960e01b83525af1801561145e5715611408579091925067ffffffffffffffff831161144b575052005b604190634e487b7160e01b5f525260245ffd5b82513d5f823e3d90fd5b5f80fd5b506f7fffffffffffffffffffffffffffffff8113156113c5565b6113aa565b600182166114ec575b607f908002811c600283166114e1575b8002811c8783166114d6575b8002811c600883166114cb575b8002901c90861c9081611398565b809302811c926114bd565b809302811c926114b0565b809302811c926114a4565b809202607f1c91611494565b603f91600160601b841061161c575b50600160701b831061160c575b600160781b83106115fc575b6001607c1b83106115f1575b506001607e1b82106115e3575b6001607f1b82106115d6575b90915f935b61156257505050848110156114685784031c906113a2565b87821015611468576001928382166115a7575b80029283607f1c92811b93600160801b841015611598575b509192911c8061154a565b9381019360801c92505f61158d565b948502607f81901c959483019490600160801b87116115c7575b50611575565b60801c9550938301935f6115c1565b9060011b905f1901611545565b9060021b9060011901611539565b91891b91015f61152c565b909160081b916007190190611520565b909160101b91600f190190611514565b60201b73ffffffffffffffffffffffffffffffff00000000169250601f91505f611507565b92611371565b6001858116149350611365565b50603c611663600d5442611f38565b11611340565b34611468575f366003190112611468576116816124aa565b42600c55005b8234611468575f3660031901126114685760165490516001600160a01b039091168152602090f35b34611468576020366003190112611468576116cc9033903561243c565b005b82346114685780600319360112611468576020906117206116ed611ea1565b5f805160206126e98339815191525f525f8452825f20335f52845261171760ff845f205416611f76565b602435906123a8565b5160018152f35b8234611468576020366003190112611468576020906001600160a01b0361174c611ea1565b165f5260098252805f20549051908152f35b8234611468578060031936011261146857611777611ea1565b90335f52602091600a8352815f209060018060a01b031690815f528352602435825f2055335f52600a8352815f20815f528352815f205482519081525f80516020612729833981519152843392a35160018152f35b8234611468575f366003190112611468576020906013549051908152f35b905034611468578160031936011261146857611804611eb7565b90336001600160a01b03831603611820576116cc92503561231f565b608490602084519162461bcd60e51b8352820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152fd5b8234611468575f366003190112611468576020906011549051908152f35b82346114685780600319360112611468576118b2611ea1565b60243591906001600160a01b031680156114685730811461146857670de0b6b3a764000061191e602094335f5260098652845f206118f1828254611f38565b9055835f5260098652845f20611908828254611f69565b9055611918601554600f0b612026565b90612013565b0482519081525f80516020612709833981519152843392a35160018152f35b8234611468575f366003190112611468576020905160128152f35b8234611468575f36600319011261146857602090517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98152f35b82346114685780600319360112611468576116cc91359060016119b3611eb7565b92805f526020905f82526119cb83855f2001546120a6565b805f525f8252835f2094838060a01b031694855f52825260ff845f205416156119f9575b5f52525f20612528565b805f525f8252835f20855f528252835f208360ff198254161790553385827f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d5f80a46119ef565b823461146857602036600319011261146857670de0b6b3a7640000611a76602093611a6f601554600f0b612026565b9035612013565b049051908152f35b8234611468575f366003190112611468576020906010549051908152f35b8234611468575f36600319011261146857602090600d549051908152f35b8234611468575f366003190112611468576020906014549051908152f35b823461146857602036600319011261146857602091355f525f82526001815f2001549051908152f35b823461146857611b1036611ecd565b92916001600160a01b0391821691908215611468573083146114685716805f525f8051602061270983398151915260208095600a8252855f20335f528252611b5b81875f2054611f38565b845f52600a8352865f20335f528352865f2055611ba5611b7a82612040565b855f5260098452611b8e81895f2054611f38565b865f5260098552885f2055865f52875f2054611f69565b855f5260098352865f20558551908152a35160018152f35b8234611468575f36600319011261146857602090610461601554600f0b612026565b8234611468575f36600319011261146857602090517f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a8668152f35b8234611468575f36600319011261146857602090610461611f59565b8234611468575f36600319011261146857602090610461611c5a610538600f54612087565b60145490611f38565b8234611468575f36600319011261146857602090600f549051908152f35b8234611468575f36600319011261146857600f54908115611ca9576020925051905f19048152f35b601283634e487b7160e01b5f525260245ffd5b8234611468578060031936011261146857602090611cd8611ea1565b602435335f52600a8452825f209160018060a01b031691825f52845280835f205582519081525f80516020612729833981519152843392a35160018152f35b8234611468575f366003190112611468578051905f9260055460018160011c91600181168015611e01575b6020948585108214611dee5750838752908115611dce5750600114611d74575b505050610bd782610be1940383611f02565b60055f9081529295507f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db05b828410611dbb5750505082610be194610bd79282010194611d62565b8054868501880152928601928101611d9f565b60ff1916868501525050151560051b8301019250610bd782610be1611d62565b602290634e487b7160e01b5f525260245ffd5b92607f1692611d42565b903461146857602036600319011261146857359063ffffffff60e01b821680920361146857602091635a05180f60e01b8114908115611e4c575b5015158152f35b637965db0b60e01b811491508115611e66575b5083611e45565b6301ffc9a760e01b14905083611e5f565b602060409281835280519182918282860152018484015e5f828201840152601f01601f1916010190565b600435906001600160a01b038216820361146857565b602435906001600160a01b038216820361146857565b6060906003190112611468576001600160a01b0390600435828116810361146857916024359081168103611468579060443590565b90601f8019910116810190811067ffffffffffffffff821117611f2457604052565b634e487b7160e01b5f52604160045260245ffd5b91908203918211611f4557565b634e487b7160e01b5f52601160045260245ffd5b600c5480611f6657504290565b90565b91908201809211611f4557565b15611f7d57565b60405162461bcd60e51b81526020600482015260156024820152744d7573742068617665206d696e74657220726f6c6560581b6044820152606490fd5b335f9081527f0781d7cac9c378efa22a7481e4d4d29704a680ddf504b3bc50b517700ee11e6c602052604090205461200e929190611ffa9060ff16611f76565b61200682601054611f38565b6010556123a8565b600190565b81810292918115918404141715611f4557565b600f0b5f811261146857670de0b6b3a76400000260401c90565b670de0b6b3a764000090818102918183041490151715611f4557612068601554600f0b612026565b908115612073570490565b634e487b7160e01b5f52601260045260245ffd5b6120a2670de0b6b3a764000091611918601554600f0b612026565b0490565b805f5260205f8152604091825f20335f52825260ff835f205416156120ca57505050565b8251339167ffffffffffffffff916060810183811182821017611f24578652602a81528481019186368437815115612288576030835381519460019560011015612288576078602184015360295b8681116122de575061229c578651936080850190811185821017611f2457875260428452858401946060368737845115612288576030865384516001101561228857607860218601536041905b808211612245575050612203579385936121e9936048937f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000976121ff9951988995860152518091603786015e8301907001034b99036b4b9b9b4b733903937b6329607d1b60378301525180928583015e015f83820152036028810185520183611f02565b5162461bcd60e51b815291829160048301611e77565b0390fd5b60648587519062461bcd60e51b825280600483015260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b9091600f81166010811015612288576f181899199a1a9b1b9c1cb0b131b232b360811b901a6122748488612517565b5360041c918015611f45575f190190612165565b634e487b7160e01b5f52603260045260245ffd5b60648688519062461bcd60e51b825280600483015260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b90600f81166010811015612288576f181899199a1a9b1b9c1cb0b131b232b360811b901a61230c8386612517565b5360041c908015611f45575f1901612118565b9061235c91805f525f60205260405f209160018060a01b031691825f5260205260ff60405f20541661235f575b5f52600160205260405f20612592565b50565b805f525f60205260405f20825f5260205260405f2060ff1981541690553382827ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b5f80a461234c565b905f8051602061270983398151915260205f927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885816123e681612040565b966123f388600f54611f69565b600f5560018060a01b038116978888526009865261241660408920918254611f69565b9055604080516001600160a01b039290921682526020820192909252a1604051908152a3565b905f8051602061270983398151915260205f937fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58161247a81612040565b9561248787600f54611f38565b600f5560018060a01b038116968789526009865261241660408a20918254611f38565b6007546001600160a01b031633036124be57565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b8054821015612288575f5260205f2001905f90565b908151811015612288570160200190565b6001810190825f528160205260405f2054155f1461258b578054600160401b811015611f2457612578612562826001879401855584612502565b819391549060031b91821b915f19901b19161790565b905554915f5260205260405f2055600190565b5050505f90565b906001820191815f528260205260405f2054908115155f1461264f575f1991808301818111611f4557825490848201918211611f455780820361261a575b50505080548015612606578201916125e88383612502565b909182549160031b1b19169055555f526020525f6040812055600190565b634e487b7160e01b5f52603160045260245ffd5b61263a61262a6125629386612502565b90549060031b1c92839286612502565b90555f528460205260405f20555f80806125d0565b505050505f90565b919290156126b9575081511561266b575090565b3b156126745790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156126cc5750805190602001fd5b60405162461bcd60e51b81529081906121ff9060048301611e7756fe9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925a2646970667358221220bc4c773e6c3985f7420c0f28f9dce356d960f8f634d686567e24d45b197fd75264736f6c634300081900332f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d

Deployed Bytecode

0x6080604081815260049182361015610015575f80fd5b5f925f3560e01c91826301ffc9a714611e0b5750816306fdde0314611d17578163095ea7b314611cbc57816311d3e6c414611c81578163143a08d414611c6357816318160ddd14611c355781631a70b99414611c1957816320606b7014611bdf578163236e123114611bbd57816323b872dd14611b01578163248a9ca314611ad8578163275d155414611aba57816328b61bd014611a9c5781632d80edcc14611a7e5781632e1bb86214611a405781632f2ff15d1461199257816330adf81f14611958578163313ce5671461193d578163336d2692146118995781633644e5151461187b57816336568abe146117ea578163378dc3dc146117cc578163395093511461175e5781633af9e6691461172757816340c10f19146116ce57816342966c68146116af578163452ed4f11461168757816346bc4189146116695781636422380a1461132157816364dd48f5146112fe578163683dd191146112dc578163685f59de146112b657816370a082311461127c578163715018a61461121f57816374c0476f1461119957816379cc679014610f4f5781637b46b80b14610f1d5781637ecebe0014610ee55781638005d20614610ec55781638187f51614610e7c57816383eb70e514610e415781638b472c6314610e225781638da5cb5b14610df95781639010d07c14610db8578163917505f414610cc057816391d1485414610c7d57816395d89b4114610b785781639e2dca8314610b59578163a217fddf14610b3e578163a457c2d714610a8b578163a9059cbb146109fc578163acecbd22146109da578163ca15c873146109b2578163cea9d26f14610818578163d505accf146105a7578163d53913931461057f578163d547741f14610541578163d5abeb0114610515578163d7a78db8146104b8578163dd62ed3e1461046b578163dfe6fd0914610441578163ee0b4bee146103d6578163f2fde38b14610306575063fec5eeab146102e2575f80fd5b34610302578160031936011261030257602090600854600f0b9051908152f35b5080fd5b9050346103d25760203660031901126103d257610321611ea1565b9061032a6124aa565b6001600160a01b03918216928315610380575050600754826bffffffffffffffffffffffff60a01b821617600755167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a380f35b906020608492519162461bcd60e51b8352820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152fd5b8280fd5b9050346103d25760203660031901126103d25761041860ff61043d935f805160206126e9833981519152865285602052808620335f526020525f205416611f76565b61043461271061042c601454933584612013565b048092611f38565b60145533611fba565b5080f35b828434610468576020366003190112610468575061046160209235612040565b9051908152f35b80fd5b505034610302578060031936011261030257602091610488611ea1565b82610491611eb7565b6001600160a01b039283168452600a8652922091165f908152908352819020549051908152f35b919050346103d25760203660031901126103d2576104fd60ff61050f9335925f805160206126e9833981519152865285602052808620335f526020525f205416611f76565b610507338261243c565b601054611f69565b60105580f35b505034610302578160031936011261030257602090610461610538600f54612087565b60105490611f69565b919050346103d257806003193601126103d25761057c91356105776001610566611eb7565b9383875286602052862001546120a6565b61231f565b80f35b505034610302578160031936011261030257602090515f805160206126e98339815191528152f35b919050346103d25760e03660031901126103d2576105c3611ea1565b906105cc611eb7565b9060443590606435946084359460ff8616809603610814578642116107db576011549660018060a01b0380921696878a5260209660128852858b20998a549a5f198c146107c85760018c019055865193858a8601937f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c985528c8a880152169b8c606087015289608087015260a086015260c085015260c0845260e0840167ffffffffffffffff92858210848311176107b5578189528551902061010086019261190160f01b845261010287015261012286015260428152610160850192818410908411176107a257828852519020928915610765575050608087928b9287519182528482015260a4358782015260c435606082015282805260015afa1561075b5787511685036107245750905f805160206127298339815191529291848752600a8352808720865f52835281815f205551908152a380f35b83606492519162461bcd60e51b8352820152601360248201527214d3d5540bda5b9d985b1a590b5c195c9b5a5d606a1b6044820152fd5b82513d89823e3d90fd5b90750534f55502f696e76616c69642d616464726573732d360541b6101a46064938b62461bcd60e51b855261016482015260166101848201520152fd5b604187634e487b7160e01b5f525260245ffd5b604188634e487b7160e01b5f525260245ffd5b634e487b7160e01b8d526011875260248dfd5b506020606492519162461bcd60e51b8352820152601360248201527214d3d5540bdc195c9b5a5d0b595e1c1a5c9959606a1b6044820152fd5b8780fd5b9050346103d25761082836611ecd565b94916108326124aa565b845163a9059cbb60e01b60208083019182526001600160a01b03948516602484015260448084019990995297825292601f199216610871606483611f02565b86519367ffffffffffffffff928589018481118782101761099f5789528986527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564868b015251869182919082855af1913d1561098f573d9081116107a257906108f7949392916108ea8a8a5195601f8401160185611f02565b83523d868a85013e612657565b80519182159186831561096b575b50505090501561091757505160018152f35b82608492519162461bcd60e51b8352820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152fd5b919381809450010312610302578401519081151582036104685750805f8086610905565b50906108f7939250606091612657565b604189634e487b7160e01b5f525260245ffd5b9050346103d25760203660031901126103d25760209282913581526001845220549051908152f35b505034610302578160031936011261030257602090600b54600f0b9051908152f35b505034610302578060031936011261030257610a16611ea1565b6001600160a01b03166024358115610a8757308214610a8757602093610a6784610a3f84612040565b9233815260098852818120610a55858254611f38565b90558581526009885220918254611f69565b905582519081525f80516020612709833981519152843392a35160018152f35b8380fd5b505034610302578060031936011261030257610aa5611ea1565b338352600a60209081528284206001600160a01b039092165f818152928252918390205490938391602435818110610b1d575050338152600a8552818120835f52855280825f20555b338152600a855220815f528352815f205482519081525f80516020612729833981519152843392a35160018152f35b610b2691611f38565b338252600a8652828220845f528652825f2055610aee565b50503461030257816003193601126103025751908152602090f35b505034610302578160031936011261030257602090600c549051908152f35b919050346103d257826003193601126103d25780519183600654906001908260011c92600181168015610c73575b6020958686108214610c605750848852908115610c3e5750600114610be5575b610be18686610bd7828b0383611f02565b5191829182611e77565b0390f35b929550600683527ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f5b828410610c2b5750505082610be194610bd792820101945f610bc6565b8054868501880152928601928101610c0e565b60ff191687860152505050151560051b8301019250610bd782610be15f610bc6565b634e487b7160e01b845260229052602483fd5b93607f1693610ba6565b9050346103d257816003193601126103d25781602093610c9b611eb7565b92358152808552209060018060a01b03165f52825260ff815f20541690519015158152f35b505034610302578060031936011261030257602091610cdd611ea1565b905f8051602061270983398151915284602435935f805160206126e98339815191528452838252858420335f528252610d1b60ff875f205416611f76565b7f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885670de0b6b3a7640000610d5c610d56601554600f0b612026565b88612013565b048092610d6b88600f54611f69565b600f5560018060a01b0381169788885260098652610d8d8a8920918254611f69565b905588516001600160a01b039190911681526020810191909152604090a18551908152a35160018152f35b9050346103d257816003193601126103d257602092610de39135815260018452826024359120612502565b905491519160018060a01b039160031b1c168152f35b50503461030257816003193601126103025760075490516001600160a01b039091168152602090f35b505034610302578160031936011261030257602090600e549051908152f35b505034610302578160031936011261030257602090517f5fde63b561377d1441afa201ff619faac2ff8fed70a7fbdbe7a5cb07768c0b758152f35b83903461030257602036600319011261030257356001600160a01b0381169081900361030257610eaa6124aa565b6bffffffffffffffffffffffff60a01b601654161760165580f35b505034610302578160031936011261030257602090610461600f54612087565b5050346103025760203660031901126103025760209181906001600160a01b03610f0d611ea1565b1681526012845220549051908152f35b505034610302578060031936011261030257602090610f46610f3d611ea1565b60243590611fba565b90519015158152f35b83915034610302578260031936011261030257610f6a611ea1565b60249384359160018060a01b031692838552602095600a8752828620335f528752825f20545f198103611078575b50841561102e57848652600287528286205490848210610fe257509183915f805160206127098339815191529487989487895260028652038288205582815403905551908152a380f35b6022915087608494519362461bcd60e51b85528401528201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152fd5b60219087608494519362461bcd60e51b85528401528201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152fd5b84811061115857849003851561110c5733156110c05785875260038852838720335f52885280845f20558351908152855f80516020612729833981519152893393a387610f98565b5060229087608494519362461bcd60e51b85528401528201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152fd5b5086608493519262461bcd60e51b8452830152808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152fd5b50601d9087606494519362461bcd60e51b85528401528201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152fd5b919050346103d25760203660031901126103d2575f805160206126e9833981519152835282602052808320335f5260205260ff815f205416156111e4575061050f9035601054611f38565b906020606492519162461bcd60e51b835282015260156024820152744d7573742068617665204d494e5445525f524f4c4560581b6044820152fd5b83346104685780600319360112610468576112386124aa565b600780546001600160a01b031981169091555f906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b505034610302576020366003190112610302576020916104619082906001600160a01b036112a8611ea1565b168152600985522054612087565b5050346103025781600319360112610302576020906104616112d6611f59565b42611f38565b505034610302578160031936011261030257602090601554600f0b9051908152f35b50503461030257816003193601126103025760209051670de0b6b3a76400008152f35b91905034611468576003195f3682011261146857600c54151580611654575b611348578380f35b600b54600f0b6113596112d6611f59565b915f8212918280611647575b15611641575f03600f0b925b6001600160801b0393600160801b92829180871691600160401b83116114f8575050603f1b905b61148b575050831c905b15611486575f035b6f7fffffffffffffffffffffffffffffff198112158061146c575b1561146857600854600f0b81600f0b12156113df57508380f35b42600d556001600160801b03196015541691161760155560018060a01b0360165416918261140c575b8380f35b823b15611468575f80938284518096819363fff6cae960e01b83525af1801561145e5715611408579091925067ffffffffffffffff831161144b575052005b604190634e487b7160e01b5f525260245ffd5b82513d5f823e3d90fd5b5f80fd5b506f7fffffffffffffffffffffffffffffff8113156113c5565b6113aa565b600182166114ec575b607f908002811c600283166114e1575b8002811c8783166114d6575b8002811c600883166114cb575b8002901c90861c9081611398565b809302811c926114bd565b809302811c926114b0565b809302811c926114a4565b809202607f1c91611494565b603f91600160601b841061161c575b50600160701b831061160c575b600160781b83106115fc575b6001607c1b83106115f1575b506001607e1b82106115e3575b6001607f1b82106115d6575b90915f935b61156257505050848110156114685784031c906113a2565b87821015611468576001928382166115a7575b80029283607f1c92811b93600160801b841015611598575b509192911c8061154a565b9381019360801c92505f61158d565b948502607f81901c959483019490600160801b87116115c7575b50611575565b60801c9550938301935f6115c1565b9060011b905f1901611545565b9060021b9060011901611539565b91891b91015f61152c565b909160081b916007190190611520565b909160101b91600f190190611514565b60201b73ffffffffffffffffffffffffffffffff00000000169250601f91505f611507565b92611371565b6001858116149350611365565b50603c611663600d5442611f38565b11611340565b34611468575f366003190112611468576116816124aa565b42600c55005b8234611468575f3660031901126114685760165490516001600160a01b039091168152602090f35b34611468576020366003190112611468576116cc9033903561243c565b005b82346114685780600319360112611468576020906117206116ed611ea1565b5f805160206126e98339815191525f525f8452825f20335f52845261171760ff845f205416611f76565b602435906123a8565b5160018152f35b8234611468576020366003190112611468576020906001600160a01b0361174c611ea1565b165f5260098252805f20549051908152f35b8234611468578060031936011261146857611777611ea1565b90335f52602091600a8352815f209060018060a01b031690815f528352602435825f2055335f52600a8352815f20815f528352815f205482519081525f80516020612729833981519152843392a35160018152f35b8234611468575f366003190112611468576020906013549051908152f35b905034611468578160031936011261146857611804611eb7565b90336001600160a01b03831603611820576116cc92503561231f565b608490602084519162461bcd60e51b8352820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152fd5b8234611468575f366003190112611468576020906011549051908152f35b82346114685780600319360112611468576118b2611ea1565b60243591906001600160a01b031680156114685730811461146857670de0b6b3a764000061191e602094335f5260098652845f206118f1828254611f38565b9055835f5260098652845f20611908828254611f69565b9055611918601554600f0b612026565b90612013565b0482519081525f80516020612709833981519152843392a35160018152f35b8234611468575f366003190112611468576020905160128152f35b8234611468575f36600319011261146857602090517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98152f35b82346114685780600319360112611468576116cc91359060016119b3611eb7565b92805f526020905f82526119cb83855f2001546120a6565b805f525f8252835f2094838060a01b031694855f52825260ff845f205416156119f9575b5f52525f20612528565b805f525f8252835f20855f528252835f208360ff198254161790553385827f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d5f80a46119ef565b823461146857602036600319011261146857670de0b6b3a7640000611a76602093611a6f601554600f0b612026565b9035612013565b049051908152f35b8234611468575f366003190112611468576020906010549051908152f35b8234611468575f36600319011261146857602090600d549051908152f35b8234611468575f366003190112611468576020906014549051908152f35b823461146857602036600319011261146857602091355f525f82526001815f2001549051908152f35b823461146857611b1036611ecd565b92916001600160a01b0391821691908215611468573083146114685716805f525f8051602061270983398151915260208095600a8252855f20335f528252611b5b81875f2054611f38565b845f52600a8352865f20335f528352865f2055611ba5611b7a82612040565b855f5260098452611b8e81895f2054611f38565b865f5260098552885f2055865f52875f2054611f69565b855f5260098352865f20558551908152a35160018152f35b8234611468575f36600319011261146857602090610461601554600f0b612026565b8234611468575f36600319011261146857602090517f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a8668152f35b8234611468575f36600319011261146857602090610461611f59565b8234611468575f36600319011261146857602090610461611c5a610538600f54612087565b60145490611f38565b8234611468575f36600319011261146857602090600f549051908152f35b8234611468575f36600319011261146857600f54908115611ca9576020925051905f19048152f35b601283634e487b7160e01b5f525260245ffd5b8234611468578060031936011261146857602090611cd8611ea1565b602435335f52600a8452825f209160018060a01b031691825f52845280835f205582519081525f80516020612729833981519152843392a35160018152f35b8234611468575f366003190112611468578051905f9260055460018160011c91600181168015611e01575b6020948585108214611dee5750838752908115611dce5750600114611d74575b505050610bd782610be1940383611f02565b60055f9081529295507f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db05b828410611dbb5750505082610be194610bd79282010194611d62565b8054868501880152928601928101611d9f565b60ff1916868501525050151560051b8301019250610bd782610be1611d62565b602290634e487b7160e01b5f525260245ffd5b92607f1692611d42565b903461146857602036600319011261146857359063ffffffff60e01b821680920361146857602091635a05180f60e01b8114908115611e4c575b5015158152f35b637965db0b60e01b811491508115611e66575b5083611e45565b6301ffc9a760e01b14905083611e5f565b602060409281835280519182918282860152018484015e5f828201840152601f01601f1916010190565b600435906001600160a01b038216820361146857565b602435906001600160a01b038216820361146857565b6060906003190112611468576001600160a01b0390600435828116810361146857916024359081168103611468579060443590565b90601f8019910116810190811067ffffffffffffffff821117611f2457604052565b634e487b7160e01b5f52604160045260245ffd5b91908203918211611f4557565b634e487b7160e01b5f52601160045260245ffd5b600c5480611f6657504290565b90565b91908201809211611f4557565b15611f7d57565b60405162461bcd60e51b81526020600482015260156024820152744d7573742068617665206d696e74657220726f6c6560581b6044820152606490fd5b335f9081527f0781d7cac9c378efa22a7481e4d4d29704a680ddf504b3bc50b517700ee11e6c602052604090205461200e929190611ffa9060ff16611f76565b61200682601054611f38565b6010556123a8565b600190565b81810292918115918404141715611f4557565b600f0b5f811261146857670de0b6b3a76400000260401c90565b670de0b6b3a764000090818102918183041490151715611f4557612068601554600f0b612026565b908115612073570490565b634e487b7160e01b5f52601260045260245ffd5b6120a2670de0b6b3a764000091611918601554600f0b612026565b0490565b805f5260205f8152604091825f20335f52825260ff835f205416156120ca57505050565b8251339167ffffffffffffffff916060810183811182821017611f24578652602a81528481019186368437815115612288576030835381519460019560011015612288576078602184015360295b8681116122de575061229c578651936080850190811185821017611f2457875260428452858401946060368737845115612288576030865384516001101561228857607860218601536041905b808211612245575050612203579385936121e9936048937f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000976121ff9951988995860152518091603786015e8301907001034b99036b4b9b9b4b733903937b6329607d1b60378301525180928583015e015f83820152036028810185520183611f02565b5162461bcd60e51b815291829160048301611e77565b0390fd5b60648587519062461bcd60e51b825280600483015260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b9091600f81166010811015612288576f181899199a1a9b1b9c1cb0b131b232b360811b901a6122748488612517565b5360041c918015611f45575f190190612165565b634e487b7160e01b5f52603260045260245ffd5b60648688519062461bcd60e51b825280600483015260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b90600f81166010811015612288576f181899199a1a9b1b9c1cb0b131b232b360811b901a61230c8386612517565b5360041c908015611f45575f1901612118565b9061235c91805f525f60205260405f209160018060a01b031691825f5260205260ff60405f20541661235f575b5f52600160205260405f20612592565b50565b805f525f60205260405f20825f5260205260405f2060ff1981541690553382827ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b5f80a461234c565b905f8051602061270983398151915260205f927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885816123e681612040565b966123f388600f54611f69565b600f5560018060a01b038116978888526009865261241660408920918254611f69565b9055604080516001600160a01b039290921682526020820192909252a1604051908152a3565b905f8051602061270983398151915260205f937fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58161247a81612040565b9561248787600f54611f38565b600f5560018060a01b038116968789526009865261241660408a20918254611f38565b6007546001600160a01b031633036124be57565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b8054821015612288575f5260205f2001905f90565b908151811015612288570160200190565b6001810190825f528160205260405f2054155f1461258b578054600160401b811015611f2457612578612562826001879401855584612502565b819391549060031b91821b915f19901b19161790565b905554915f5260205260405f2055600190565b5050505f90565b906001820191815f528260205260405f2054908115155f1461264f575f1991808301818111611f4557825490848201918211611f455780820361261a575b50505080548015612606578201916125e88383612502565b909182549160031b1b19169055555f526020525f6040812055600190565b634e487b7160e01b5f52603160045260245ffd5b61263a61262a6125629386612502565b90549060031b1c92839286612502565b90555f528460205260405f20555f80806125d0565b505050505f90565b919290156126b9575081511561266b575090565b3b156126745790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156126cc5750805190602001fd5b60405162461bcd60e51b81529081906121ff9060048301611e7756fe9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925a2646970667358221220bc4c773e6c3985f7420c0f28f9dce356d960f8f634d686567e24d45b197fd75264736f6c63430008190033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

OVERVIEW

$SOUP is a gaming token. In SOUP island, only the truly greedy goblins can cook, and 1 special ingredient they need - $SOUP.

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.