Contract 0x76373EaE8d8facE76476f6B9edefcAf8B677D106

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x4a3ccdc5cac5e196421f5cf2a314c9dfbe3382910d7532181e2a2e75e2aaebe10x60806040679306542023-03-08 14:22:43386 days 3 hrs ago0x7adc86401f246b87177cebbec189de075b75af3a IN  Create: Pegging0 ETH0.001285750.1
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Pegging

Compiler Version
v0.8.16+commit.07a7930e

Optimization Enabled:
Yes with 10000000 runs

Other Settings:
default evmVersion, GNU GPLv2 license

Contract Source Code (Solidity Multiple files format)

File 1 of 30: Pegging.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity 0.8.16;
pragma experimental ABIEncoderV2;

// ====================================================================
// ====================== Pegging.sol ==============================
// ====================================================================

// Primary Author(s)
// MAXOS Team: https://maxos.finance/

/*
**   The intention of this contract is to attepmt to calculate
**   the required amount of SWEEP to buy from the Uniswap AMM
**   in order to take the price to a desired target price.
*/

import "./IERC20.sol";
import "./ISweep.sol";

import "./SafeMath.sol";
import "./ABDKMath64x64.sol";
import "./IUniswapV3Pool.sol";
import "./TickMath.sol";
import "./FullMath.sol";
import "./FixedPoint96.sol";
import "./SqrtPriceMath.sol";
import "./IUniswapV3Factory.sol";
import "./INonfungiblePositionManager.sol";

contract Pegging {
    using SafeMath for uint256;

    IERC20 public USDX;
    ISweep public SWEEP;
    IUniswapV3Factory public constant uniswap_factory =
        IUniswapV3Factory(0x1F98431c8aD98523631AE4a59f267346ea31F984);
    INonfungiblePositionManager public constant nonfungiblePositionManager =
        INonfungiblePositionManager(0xC36442b4a4522E871399CD717aBDD847Ab11FE88);

    constructor(
        address _sweep_address,
        address _usdc_address
    ) {
        USDX = IERC20(_usdc_address);
        SWEEP = ISweep(_sweep_address);
    }

    function amountToPeg_UsingConstantProduct() public view returns (uint256 amount) {
        address uniswapV3Pool = uniswap_factory.getPool(address(SWEEP), address(USDX), 3000);
        IUniswapV3Pool pool = IUniswapV3Pool(uniswapV3Pool);

        uint256 sweep_amount = SWEEP.balanceOf(uniswapV3Pool);
        uint256 usdx_amount = USDX.balanceOf(uniswapV3Pool);
        uint256 target_price = SWEEP.target_price();
        uint256 radicand = target_price * sweep_amount * usdx_amount * 1e6;
        uint256 root = radicand.sqrt();

        uint256 sweep_to_peg = (root > sweep_amount) ? (root - sweep_amount) : (sweep_amount - root);
        sweep_to_peg = sweep_to_peg * 997 / 1000;

        (, int24 tickCurrent, , , , , ) = pool.slot0();

        amount = getQuoteAtTick(tickCurrent, uint128(sweep_to_peg), address(SWEEP), address(USDX));
    }

    function amountToPeg_UsingTicks(uint256 tokenId) public view returns (uint256 amount) {
        address uniswapV3Pool = uniswap_factory.getPool(address(SWEEP), address(USDX), 3000);
        IUniswapV3Pool pool = IUniswapV3Pool(uniswapV3Pool);
        (, int24 tickCurrent, , , , , ) = pool.slot0();
        (,,,,, int24 tickLower,, uint128 liquidity,,,,) = nonfungiblePositionManager.positions(tokenId);

        int24 targetTick = getTickFromPrice(SWEEP.target_price(), 18);

        uint256 currentSweepAmount = SqrtPriceMath.getAmount0Delta(uint160(uint24(tickLower)), uint160(uint24(tickCurrent)), liquidity, true) / 1e32;
        uint256 targetSweepAmount = SqrtPriceMath.getAmount0Delta(uint160(uint24(tickLower)), uint160(uint24(targetTick)), liquidity, true) / 1e32;

        amount = (targetSweepAmount > currentSweepAmount ) ?
            targetSweepAmount - currentSweepAmount : 0;
    }

    function getTickFromPrice(uint256 _price, uint256 _decimals)
        public
        pure
        returns (int24 _tick)
    {
        int24 tickSpacing = 60;
        int128 value1 = ABDKMath64x64.fromUInt(10**_decimals);
        int128 value2 = ABDKMath64x64.fromUInt(_price);
        int128 value = ABDKMath64x64.div(value1, value2);
        _tick = TickMath.getTickAtSqrtRatio(
            uint160(int160(ABDKMath64x64.sqrt(value) << (FixedPoint96.RESOLUTION - 64)))
        );

        _tick = (_tick / tickSpacing) * tickSpacing;
    }

    function getQuoteAtTick(
        int24 tick,
        uint128 baseAmount,
        address baseToken,
        address quoteToken
    ) public pure returns (uint256 quoteAmount) {
        uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(tick);

        // Calculate quoteAmount with better precision if it doesn't overflow when multiplied by itself
        if (sqrtRatioX96 <= type(uint128).max) {
            uint256 ratioX192 = uint256(sqrtRatioX96) * sqrtRatioX96;
            quoteAmount = baseToken < quoteToken
                ? FullMath.mulDiv(ratioX192, baseAmount, 1 << 192)
                : FullMath.mulDiv(1 << 192, baseAmount, ratioX192);
        } else {
            uint256 ratioX128 = FullMath.mulDiv(sqrtRatioX96, sqrtRatioX96, 1 << 64);
            quoteAmount = baseToken < quoteToken
                ? FullMath.mulDiv(ratioX128, baseAmount, 1 << 128)
                : FullMath.mulDiv(1 << 128, baseAmount, ratioX128);
        }
    }

}

File 2 of 30: 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

        assert (xh == hi >> 128);

        result += xl / y;
      }

      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 3 of 30: FixedPoint96.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.4.0;

/// @title FixedPoint96
/// @notice A library for handling binary fixed point numbers, see https://en.wikipedia.org/wiki/Q_(number_format)
/// @dev Used in SqrtPriceMath.sol
library FixedPoint96 {
    uint8 internal constant RESOLUTION = 96;
    uint256 internal constant Q96 = 0x1000000000000000000000000;
}

File 4 of 30: FullMath.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;

/// @title Contains 512-bit math functions
/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision
/// @dev Handles "phantom overflow" i.e., allows multiplication and division where an intermediate value overflows 256 bits
library FullMath {
    /// @notice Calculates floor(x*y÷denominator) with full precision.
    ///
    /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv.
    ///
    /// Requirements:
    /// - The denominator cannot be zero.
    /// - The result must fit within uint256.
    ///
    /// Caveats:
    /// - This function does not work with fixed-point numbers.
    ///
    /// @param x The multiplicand as an uint256.
    /// @param y The multiplier as an uint256.
    /// @param denominator The divisor as an uint256.
    /// @return result The result as an uint256.
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        // 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) {
            require(denominator > 0);
            unchecked {
                result = prod0 / denominator;
            }
            return result;
        }

        // Make sure the result is less than 2^256. Also prevents denominator == 0.
        

        ///////////////////////////////////////////////
        // 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.
        unchecked {
            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 lpotdod = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by lpotdod.
                denominator := div(denominator, lpotdod)

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

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

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

            // 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 ceil(a×b÷denominator) with full precision. Throws if result overflows x uint256 or denominator == 0
    /// @param x The multiplicand
    /// @param y The multiplier
    /// @param denominator The divisor
    /// @return result The 256-bit result
    function mulDivRoundingUp(
        uint256 x,
        uint256 y,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        result = mulDiv(x, y, denominator);
        if (mulmod(x, y, denominator) > 0) {
            require(result < type(uint256).max);
            result++;
        }
    }
}

File 5 of 30: 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 6 of 30: IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity 0.8.16;

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

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

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

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

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

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

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

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

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

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

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

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

File 8 of 30: IERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "./IERC721.sol";

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

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

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

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

pragma solidity ^0.8.0;

import "./IERC721.sol";

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

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

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

File 10 of 30: IERC721Permit.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;

import './IERC721.sol';

/// @title ERC721 with permit
/// @notice Extension to ERC721 that includes a permit function for signature based approvals
interface IERC721Permit is IERC721 {
    /// @notice The permit typehash used in the permit signature
    /// @return The typehash for the permit
    function PERMIT_TYPEHASH() external pure returns (bytes32);

    /// @notice The domain separator used in the permit signature
    /// @return The domain seperator used in encoding of permit signature
    function DOMAIN_SEPARATOR() external view returns (bytes32);

    /// @notice Approve of a specific token ID for spending by spender via signature
    /// @param spender The account that is being approved
    /// @param tokenId The ID of the token that is being approved for spending
    /// @param deadline The deadline timestamp by which the call must be mined for the approve to work
    /// @param v Must produce valid secp256k1 signature from the holder along with `r` and `s`
    /// @param r Must produce valid secp256k1 signature from the holder along with `v` and `s`
    /// @param s Must produce valid secp256k1 signature from the holder along with `r` and `v`
    function permit(
        address spender,
        uint256 tokenId,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external payable;
}

File 11 of 30: INonfungiblePositionManager.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;
pragma abicoder v2;

import './IPoolInitializer.sol';
import './IPeripheryPayments.sol';
import './IPeripheryImmutableState.sol';
import './PoolAddress.sol';
import './IERC721Metadata.sol';
import './IERC721Enumerable.sol';
import './IERC721Permit.sol';

/// @title Non-fungible token for positions
/// @notice Wraps Uniswap V3 positions in a non-fungible token interface which allows for them to be transferred
/// and authorized.
interface INonfungiblePositionManager is
    IPoolInitializer,
    IPeripheryPayments,
    IPeripheryImmutableState,
    IERC721Metadata,
    IERC721Enumerable,
    IERC721Permit
{
    /// @notice Emitted when liquidity is increased for a position NFT
    /// @dev Also emitted when a token is minted
    /// @param tokenId The ID of the token for which liquidity was increased
    /// @param liquidity The amount by which liquidity for the NFT position was increased
    /// @param amount0 The amount of token0 that was paid for the increase in liquidity
    /// @param amount1 The amount of token1 that was paid for the increase in liquidity
    event IncreaseLiquidity(uint256 indexed tokenId, uint128 liquidity, uint256 amount0, uint256 amount1);
    /// @notice Emitted when liquidity is decreased for a position NFT
    /// @param tokenId The ID of the token for which liquidity was decreased
    /// @param liquidity The amount by which liquidity for the NFT position was decreased
    /// @param amount0 The amount of token0 that was accounted for the decrease in liquidity
    /// @param amount1 The amount of token1 that was accounted for the decrease in liquidity
    event DecreaseLiquidity(uint256 indexed tokenId, uint128 liquidity, uint256 amount0, uint256 amount1);
    /// @notice Emitted when tokens are collected for a position NFT
    /// @dev The amounts reported may not be exactly equivalent to the amounts transferred, due to rounding behavior
    /// @param tokenId The ID of the token for which underlying tokens were collected
    /// @param recipient The address of the account that received the collected tokens
    /// @param amount0 The amount of token0 owed to the position that was collected
    /// @param amount1 The amount of token1 owed to the position that was collected
    event Collect(uint256 indexed tokenId, address recipient, uint256 amount0, uint256 amount1);

    /// @notice Returns the position information associated with a given token ID.
    /// @dev Throws if the token ID is not valid.
    /// @param tokenId The ID of the token that represents the position
    /// @return nonce The nonce for permits
    /// @return operator The address that is approved for spending
    /// @return token0 The address of the token0 for a specific pool
    /// @return token1 The address of the token1 for a specific pool
    /// @return fee The fee associated with the pool
    /// @return tickLower The lower end of the tick range for the position
    /// @return tickUpper The higher end of the tick range for the position
    /// @return liquidity The liquidity of the position
    /// @return feeGrowthInside0LastX128 The fee growth of token0 as of the last action on the individual position
    /// @return feeGrowthInside1LastX128 The fee growth of token1 as of the last action on the individual position
    /// @return tokensOwed0 The uncollected amount of token0 owed to the position as of the last computation
    /// @return tokensOwed1 The uncollected amount of token1 owed to the position as of the last computation
    function positions(uint256 tokenId)
        external
        view
        returns (
            uint96 nonce,
            address operator,
            address token0,
            address token1,
            uint24 fee,
            int24 tickLower,
            int24 tickUpper,
            uint128 liquidity,
            uint256 feeGrowthInside0LastX128,
            uint256 feeGrowthInside1LastX128,
            uint128 tokensOwed0,
            uint128 tokensOwed1
        );

    struct MintParams {
        address token0;
        address token1;
        uint24 fee;
        int24 tickLower;
        int24 tickUpper;
        uint256 amount0Desired;
        uint256 amount1Desired;
        uint256 amount0Min;
        uint256 amount1Min;
        address recipient;
        uint256 deadline;
    }

    /// @notice Creates a new position wrapped in a NFT
    /// @dev Call this when the pool does exist and is initialized. Note that if the pool is created but not initialized
    /// a method does not exist, i.e. the pool is assumed to be initialized.
    /// @param params The params necessary to mint a position, encoded as `MintParams` in calldata
    /// @return tokenId The ID of the token that represents the minted position
    /// @return liquidity The amount of liquidity for this position
    /// @return amount0 The amount of token0
    /// @return amount1 The amount of token1
    function mint(MintParams calldata params)
        external
        payable
        returns (
            uint256 tokenId,
            uint128 liquidity,
            uint256 amount0,
            uint256 amount1
        );

    struct IncreaseLiquidityParams {
        uint256 tokenId;
        uint256 amount0Desired;
        uint256 amount1Desired;
        uint256 amount0Min;
        uint256 amount1Min;
        uint256 deadline;
    }

    /// @notice Increases the amount of liquidity in a position, with tokens paid by the `msg.sender`
    /// @param params tokenId The ID of the token for which liquidity is being increased,
    /// amount0Desired The desired amount of token0 to be spent,
    /// amount1Desired The desired amount of token1 to be spent,
    /// amount0Min The minimum amount of token0 to spend, which serves as a slippage check,
    /// amount1Min The minimum amount of token1 to spend, which serves as a slippage check,
    /// deadline The time by which the transaction must be included to effect the change
    /// @return liquidity The new liquidity amount as a result of the increase
    /// @return amount0 The amount of token0 to acheive resulting liquidity
    /// @return amount1 The amount of token1 to acheive resulting liquidity
    function increaseLiquidity(IncreaseLiquidityParams calldata params)
        external
        payable
        returns (
            uint128 liquidity,
            uint256 amount0,
            uint256 amount1
        );

    struct DecreaseLiquidityParams {
        uint256 tokenId;
        uint128 liquidity;
        uint256 amount0Min;
        uint256 amount1Min;
        uint256 deadline;
    }

    /// @notice Decreases the amount of liquidity in a position and accounts it to the position
    /// @param params tokenId The ID of the token for which liquidity is being decreased,
    /// amount The amount by which liquidity will be decreased,
    /// amount0Min The minimum amount of token0 that should be accounted for the burned liquidity,
    /// amount1Min The minimum amount of token1 that should be accounted for the burned liquidity,
    /// deadline The time by which the transaction must be included to effect the change
    /// @return amount0 The amount of token0 accounted to the position's tokens owed
    /// @return amount1 The amount of token1 accounted to the position's tokens owed
    function decreaseLiquidity(DecreaseLiquidityParams calldata params)
        external
        payable
        returns (uint256 amount0, uint256 amount1);

    struct CollectParams {
        uint256 tokenId;
        address recipient;
        uint128 amount0Max;
        uint128 amount1Max;
    }

    /// @notice Collects up to a maximum amount of fees owed to a specific position to the recipient
    /// @param params tokenId The ID of the NFT for which tokens are being collected,
    /// recipient The account that should receive the tokens,
    /// amount0Max The maximum amount of token0 to collect,
    /// amount1Max The maximum amount of token1 to collect
    /// @return amount0 The amount of fees collected in token0
    /// @return amount1 The amount of fees collected in token1
    function collect(CollectParams calldata params) external payable returns (uint256 amount0, uint256 amount1);

    /// @notice Burns a token ID, which deletes it from the NFT contract. The token must have 0 liquidity and all tokens
    /// must be collected first.
    /// @param tokenId The ID of the token that is being burned
    function burn(uint256 tokenId) external payable;
}

File 12 of 30: IPeripheryImmutableState.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Immutable state
/// @notice Functions that return immutable state of the router
interface IPeripheryImmutableState {
    /// @return Returns the address of the Uniswap V3 factory
    function factory() external view returns (address);

    /// @return Returns the address of WETH9
    function WETH9() external view returns (address);
}

File 13 of 30: IPeripheryPayments.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;

/// @title Periphery Payments
/// @notice Functions to ease deposits and withdrawals of ETH
interface IPeripheryPayments {
    /// @notice Unwraps the contract's WETH9 balance and sends it to recipient as ETH.
    /// @dev The amountMinimum parameter prevents malicious contracts from stealing WETH9 from users.
    /// @param amountMinimum The minimum amount of WETH9 to unwrap
    /// @param recipient The address receiving ETH
    function unwrapWETH9(uint256 amountMinimum, address recipient) external payable;

    /// @notice Refunds any ETH balance held by this contract to the `msg.sender`
    /// @dev Useful for bundling with mint or increase liquidity that uses ether, or exact output swaps
    /// that use ether for the input amount
    function refundETH() external payable;

    /// @notice Transfers the full amount of a token held by this contract to recipient
    /// @dev The amountMinimum parameter prevents malicious contracts from stealing the token from users
    /// @param token The contract address of the token which will be transferred to `recipient`
    /// @param amountMinimum The minimum amount of token required for a transfer
    /// @param recipient The destination address of the token
    function sweepToken(
        address token,
        uint256 amountMinimum,
        address recipient
    ) external payable;
}

File 14 of 30: IPoolInitializer.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;
pragma abicoder v2;

/// @title Creates and initializes V3 Pools
/// @notice Provides a method for creating and initializing a pool, if necessary, for bundling with other methods that
/// require the pool to exist.
interface IPoolInitializer {
    /// @notice Creates a new pool if it does not exist, then initializes if not initialized
    /// @dev This method can be bundled with others via IMulticall for the first action (e.g. mint) performed against a pool
    /// @param token0 The contract address of token0 of the pool
    /// @param token1 The contract address of token1 of the pool
    /// @param fee The fee amount of the v3 pool for the specified token pair
    /// @param sqrtPriceX96 The initial square root price of the pool as a Q64.96 value
    /// @return pool Returns the pool address based on the pair of tokens and fee, will return the newly created pool address if necessary
    function createAndInitializePoolIfNecessary(
        address token0,
        address token1,
        uint24 fee,
        uint160 sqrtPriceX96
    ) external payable returns (address pool);
}

File 15 of 30: ISweep.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity 0.8.16;

interface ISweep {
    struct Minter {
        uint256 max_amount;
        uint256 minted_amount;
        bool is_listed;
        bool is_enabled;
    }

    function DEFAULT_ADMIN_ADDRESS() external view returns (address);

    function balancer() external view returns (address);

    function treasury() external view returns (address);

    function collateral_agency() external view returns (address);

    function allowance(address owner, address spender) external view returns (uint256);

    function approve(address spender, uint256 amount) external returns (bool);

    function balanceOf(address account) external view returns (uint256);

    function decimals() external view returns (uint8);

    function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool);

    function isValidMinter(address) external view returns (bool);

    function amm_price() external view returns (uint256);

    function increaseAllowance(address spender, uint256 addedValue) external returns (bool);

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

    function owner() external view returns (address);

    function minter_burn_from(uint256 amount) external;

    function minter_mint(address m_address, uint256 m_amount) external;

    function minters(address m_address) external returns (Minter memory);

    function target_price() external view returns (uint256);

    function interest_rate() external view returns (int256);

    function period_time() external view returns (uint256);

    function step_value() external view returns (int256);

    function setInterestRate(int256 interest_rate) external;

    function setTargetPrice(uint256 current_target_price, uint256 next_target_price) external;    

    function startNewPeriod() external;

    function setUniswapOracle(address uniswap_oracle_address) external;

    function setTimelock(address new_timelock) external;

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

    function timelock_address() external view returns (address);

    function totalSupply() external view returns (uint256);

    function convertToUSDX(uint256 amount) external view returns (uint256);

    function convertToSWEEP(uint256 amount) external view returns (uint256);

    function transfer(address recipient, uint256 amount) external returns (bool);

    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) external returns (bool);
}

File 16 of 30: IUniswapV3Factory.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity 0.8.16;

/// @title The interface for the Uniswap V3 Factory
/// @notice The Uniswap V3 Factory facilitates creation of Uniswap V3 pools and control over the protocol fees
interface IUniswapV3Factory {
    /// @notice Emitted when the owner of the factory is changed
    /// @param oldOwner The owner before the owner was changed
    /// @param newOwner The owner after the owner was changed
    event OwnerChanged(address indexed oldOwner, address indexed newOwner);

    /// @notice Emitted when a pool is created
    /// @param token0 The first token of the pool by address sort order
    /// @param token1 The second token of the pool by address sort order
    /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip
    /// @param tickSpacing The minimum number of ticks between initialized ticks
    /// @param pool The address of the created pool
    event PoolCreated(
        address indexed token0,
        address indexed token1,
        uint24 indexed fee,
        int24 tickSpacing,
        address pool
    );

    /// @notice Emitted when a new fee amount is enabled for pool creation via the factory
    /// @param fee The enabled fee, denominated in hundredths of a bip
    /// @param tickSpacing The minimum number of ticks between initialized ticks for pools created with the given fee
    event FeeAmountEnabled(uint24 indexed fee, int24 indexed tickSpacing);

    /// @notice Returns the current owner of the factory
    /// @dev Can be changed by the current owner via setOwner
    /// @return The address of the factory owner
    function owner() external view returns (address);

    /// @notice Returns the tick spacing for a given fee amount, if enabled, or 0 if not enabled
    /// @dev A fee amount can never be removed, so this value should be hard coded or cached in the calling context
    /// @param fee The enabled fee, denominated in hundredths of a bip. Returns 0 in case of unenabled fee
    /// @return The tick spacing
    function feeAmountTickSpacing(uint24 fee) external view returns (int24);

    /// @notice Returns the pool address for a given pair of tokens and a fee, or address 0 if it does not exist
    /// @dev tokenA and tokenB may be passed in either token0/token1 or token1/token0 order
    /// @param tokenA The contract address of either token0 or token1
    /// @param tokenB The contract address of the other token
    /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip
    /// @return pool The pool address
    function getPool(
        address tokenA,
        address tokenB,
        uint24 fee
    ) external view returns (address pool);

    /// @notice Creates a pool for the given two tokens and fee
    /// @param tokenA One of the two tokens in the desired pool
    /// @param tokenB The other of the two tokens in the desired pool
    /// @param fee The desired fee for the pool
    /// @dev tokenA and tokenB may be passed in either order: token0/token1 or token1/token0. tickSpacing is retrieved
    /// from the fee. The call will revert if the pool already exists, the fee is invalid, or the token arguments
    /// are invalid.
    /// @return pool The address of the newly created pool
    function createPool(
        address tokenA,
        address tokenB,
        uint24 fee
    ) external returns (address pool);

    /// @notice Updates the owner of the factory
    /// @dev Must be called by the current owner
    /// @param _owner The new owner of the factory
    function setOwner(address _owner) external;

    /// @notice Enables a fee amount with the given tickSpacing
    /// @dev Fee amounts may never be removed once enabled
    /// @param fee The fee amount to enable, denominated in hundredths of a bip (i.e. 1e-6)
    /// @param tickSpacing The spacing between ticks to be enforced for all pools created with the given fee amount
    function enableFeeAmount(uint24 fee, int24 tickSpacing) external;
}

File 17 of 30: IUniswapV3Pool.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity 0.8.16;

import './IUniswapV3PoolImmutables.sol';
import './IUniswapV3PoolState.sol';
import './IUniswapV3PoolDerivedState.sol';
import './IUniswapV3PoolActions.sol';
import './IUniswapV3PoolOwnerActions.sol';
import './IUniswapV3PoolEvents.sol';

/// @title The interface for a Uniswap V3 Pool
/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform
/// to the ERC20 specification
/// @dev The pool interface is broken up into many smaller pieces
interface IUniswapV3Pool is
    IUniswapV3PoolImmutables,
    IUniswapV3PoolState,
    IUniswapV3PoolDerivedState,
    IUniswapV3PoolActions,
    IUniswapV3PoolOwnerActions,
    IUniswapV3PoolEvents
{

}

File 18 of 30: IUniswapV3PoolActions.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;

/// @title Permissionless pool actions
/// @notice Contains pool methods that can be called by anyone
interface IUniswapV3PoolActions {
    /// @notice Sets the initial price for the pool
    /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value
    /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96
    function initialize(uint160 sqrtPriceX96) external;

    /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position
    /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback
    /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends
    /// on tickLower, tickUpper, the amount of liquidity, and the current price.
    /// @param recipient The address for which the liquidity will be created
    /// @param tickLower The lower tick of the position in which to add liquidity
    /// @param tickUpper The upper tick of the position in which to add liquidity
    /// @param amount The amount of liquidity to mint
    /// @param data Any data that should be passed through to the callback
    /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback
    /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback
    function mint(
        address recipient,
        int24 tickLower,
        int24 tickUpper,
        uint128 amount,
        bytes calldata data
    ) external returns (uint256 amount0, uint256 amount1);

    /// @notice Collects tokens owed to a position
    /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.
    /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or
    /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the
    /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.
    /// @param recipient The address which should receive the fees collected
    /// @param tickLower The lower tick of the position for which to collect fees
    /// @param tickUpper The upper tick of the position for which to collect fees
    /// @param amount0Requested How much token0 should be withdrawn from the fees owed
    /// @param amount1Requested How much token1 should be withdrawn from the fees owed
    /// @return amount0 The amount of fees collected in token0
    /// @return amount1 The amount of fees collected in token1
    function collect(
        address recipient,
        int24 tickLower,
        int24 tickUpper,
        uint128 amount0Requested,
        uint128 amount1Requested
    ) external returns (uint128 amount0, uint128 amount1);

    /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position
    /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0
    /// @dev Fees must be collected separately via a call to #collect
    /// @param tickLower The lower tick of the position for which to burn liquidity
    /// @param tickUpper The upper tick of the position for which to burn liquidity
    /// @param amount How much liquidity to burn
    /// @return amount0 The amount of token0 sent to the recipient
    /// @return amount1 The amount of token1 sent to the recipient
    function burn(
        int24 tickLower,
        int24 tickUpper,
        uint128 amount
    ) external returns (uint256 amount0, uint256 amount1);

    /// @notice Swap token0 for token1, or token1 for token0
    /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback
    /// @param recipient The address to receive the output of the swap
    /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0
    /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)
    /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this
    /// value after the swap. If one for zero, the price cannot be greater than this value after the swap
    /// @param data Any data to be passed through to the callback
    /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive
    /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive
    function swap(
        address recipient,
        bool zeroForOne,
        int256 amountSpecified,
        uint160 sqrtPriceLimitX96,
        bytes calldata data
    ) external returns (int256 amount0, int256 amount1);

    /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback
    /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback
    /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling
    /// with 0 amount{0,1} and sending the donation amount(s) from the callback
    /// @param recipient The address which will receive the token0 and token1 amounts
    /// @param amount0 The amount of token0 to send
    /// @param amount1 The amount of token1 to send
    /// @param data Any data to be passed through to the callback
    function flash(
        address recipient,
        uint256 amount0,
        uint256 amount1,
        bytes calldata data
    ) external;

    /// @notice Increase the maximum number of price and liquidity observations that this pool will store
    /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to
    /// the input observationCardinalityNext.
    /// @param observationCardinalityNext The desired minimum number of observations for the pool to store
    function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;
}

File 19 of 30: IUniswapV3PoolDerivedState.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;

/// @title Pool state that is not stored
/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the
/// blockchain. The functions here may have variable gas costs.
interface IUniswapV3PoolDerivedState {
    /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp
    /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing
    /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,
    /// you must call it with secondsAgos = [3600, 0].
    /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in
    /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.
    /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned
    /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp
    /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block
    /// timestamp
    function observe(uint32[] calldata secondsAgos)
        external
        view
        returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);

    /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range
    /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.
    /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first
    /// snapshot is taken and the second snapshot is taken.
    /// @param tickLower The lower tick of the range
    /// @param tickUpper The upper tick of the range
    /// @return tickCumulativeInside The snapshot of the tick accumulator for the range
    /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range
    /// @return secondsInside The snapshot of seconds per liquidity for the range
    function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)
        external
        view
        returns (
            int56 tickCumulativeInside,
            uint160 secondsPerLiquidityInsideX128,
            uint32 secondsInside
        );
}

File 20 of 30: IUniswapV3PoolEvents.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity 0.8.16;

/// @title Events emitted by a pool
/// @notice Contains all events emitted by the pool
interface IUniswapV3PoolEvents {
    /// @notice Emitted exactly once by a pool when #initialize is first called on the pool
    /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize
    /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96
    /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool
    event Initialize(uint160 sqrtPriceX96, int24 tick);

    /// @notice Emitted when liquidity is minted for a given position
    /// @param sender The address that minted the liquidity
    /// @param owner The owner of the position and recipient of any minted liquidity
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param amount The amount of liquidity minted to the position range
    /// @param amount0 How much token0 was required for the minted liquidity
    /// @param amount1 How much token1 was required for the minted liquidity
    event Mint(
        address sender,
        address indexed owner,
        int24 indexed tickLower,
        int24 indexed tickUpper,
        uint128 amount,
        uint256 amount0,
        uint256 amount1
    );

    /// @notice Emitted when fees are collected by the owner of a position
    /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees
    /// @param owner The owner of the position for which fees are collected
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param amount0 The amount of token0 fees collected
    /// @param amount1 The amount of token1 fees collected
    event Collect(
        address indexed owner,
        address recipient,
        int24 indexed tickLower,
        int24 indexed tickUpper,
        uint128 amount0,
        uint128 amount1
    );

    /// @notice Emitted when a position's liquidity is removed
    /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect
    /// @param owner The owner of the position for which liquidity is removed
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param amount The amount of liquidity to remove
    /// @param amount0 The amount of token0 withdrawn
    /// @param amount1 The amount of token1 withdrawn
    event Burn(
        address indexed owner,
        int24 indexed tickLower,
        int24 indexed tickUpper,
        uint128 amount,
        uint256 amount0,
        uint256 amount1
    );

    /// @notice Emitted by the pool for any swaps between token0 and token1
    /// @param sender The address that initiated the swap call, and that received the callback
    /// @param recipient The address that received the output of the swap
    /// @param amount0 The delta of the token0 balance of the pool
    /// @param amount1 The delta of the token1 balance of the pool
    /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96
    /// @param liquidity The liquidity of the pool after the swap
    /// @param tick The log base 1.0001 of price of the pool after the swap
    event Swap(
        address indexed sender,
        address indexed recipient,
        int256 amount0,
        int256 amount1,
        uint160 sqrtPriceX96,
        uint128 liquidity,
        int24 tick
    );

    /// @notice Emitted by the pool for any flashes of token0/token1
    /// @param sender The address that initiated the swap call, and that received the callback
    /// @param recipient The address that received the tokens from flash
    /// @param amount0 The amount of token0 that was flashed
    /// @param amount1 The amount of token1 that was flashed
    /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee
    /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee
    event Flash(
        address indexed sender,
        address indexed recipient,
        uint256 amount0,
        uint256 amount1,
        uint256 paid0,
        uint256 paid1
    );

    /// @notice Emitted by the pool for increases to the number of observations that can be stored
    /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index
    /// just before a mint/swap/burn.
    /// @param observationCardinalityNextOld The previous value of the next observation cardinality
    /// @param observationCardinalityNextNew The updated value of the next observation cardinality
    event IncreaseObservationCardinalityNext(
        uint16 observationCardinalityNextOld,
        uint16 observationCardinalityNextNew
    );

    /// @notice Emitted when the protocol fee is changed by the pool
    /// @param feeProtocol0Old The previous value of the token0 protocol fee
    /// @param feeProtocol1Old The previous value of the token1 protocol fee
    /// @param feeProtocol0New The updated value of the token0 protocol fee
    /// @param feeProtocol1New The updated value of the token1 protocol fee
    event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);

    /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner
    /// @param sender The address that collects the protocol fees
    /// @param recipient The address that receives the collected protocol fees
    /// @param amount0 The amount of token0 protocol fees that is withdrawn
    /// @param amount0 The amount of token1 protocol fees that is withdrawn
    event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);
}

File 21 of 30: IUniswapV3PoolImmutables.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity 0.8.16;

/// @title Pool state that never changes
/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values
interface IUniswapV3PoolImmutables {
    /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface
    /// @return The contract address
    function factory() external view returns (address);

    /// @notice The first of the two tokens of the pool, sorted by address
    /// @return The token contract address
    function token0() external view returns (address);

    /// @notice The second of the two tokens of the pool, sorted by address
    /// @return The token contract address
    function token1() external view returns (address);

    /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6
    /// @return The fee
    function fee() external view returns (uint24);

    /// @notice The pool tick spacing
    /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive
    /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...
    /// This value is an int24 to avoid casting even though it is always positive.
    /// @return The tick spacing
    function tickSpacing() external view returns (int24);

    /// @notice The maximum amount of position liquidity that can use any tick in the range
    /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and
    /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool
    /// @return The max amount of liquidity per tick
    function maxLiquidityPerTick() external view returns (uint128);
}

File 22 of 30: IUniswapV3PoolOwnerActions.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity 0.8.16;

/// @title Permissioned pool actions
/// @notice Contains pool methods that may only be called by the factory owner
interface IUniswapV3PoolOwnerActions {
    /// @notice Set the denominator of the protocol's % share of the fees
    /// @param feeProtocol0 new protocol fee for token0 of the pool
    /// @param feeProtocol1 new protocol fee for token1 of the pool
    function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;

    /// @notice Collect the protocol fee accrued to the pool
    /// @param recipient The address to which collected protocol fees should be sent
    /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1
    /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0
    /// @return amount0 The protocol fee collected in token0
    /// @return amount1 The protocol fee collected in token1
    function collectProtocol(
        address recipient,
        uint128 amount0Requested,
        uint128 amount1Requested
    ) external returns (uint128 amount0, uint128 amount1);
}

File 23 of 30: IUniswapV3PoolState.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity 0.8.16;

/// @title Pool state that can change
/// @notice These methods compose the pool's state, and can change with any frequency including multiple times
/// per transaction
interface IUniswapV3PoolState {
    /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas
    /// when accessed externally.
    /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value
    /// tick The current tick of the pool, i.e. according to the last tick transition that was run.
    /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick
    /// boundary.
    /// observationIndex The index of the last oracle observation that was written,
    /// observationCardinality The current maximum number of observations stored in the pool,
    /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.
    /// feeProtocol The protocol fee for both tokens of the pool.
    /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0
    /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.
    /// unlocked Whether the pool is currently locked to reentrancy
    function slot0()
        external
        view
        returns (
            uint160 sqrtPriceX96,
            int24 tick,
            uint16 observationIndex,
            uint16 observationCardinality,
            uint16 observationCardinalityNext,
            uint8 feeProtocol,
            bool unlocked
        );

    /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool
    /// @dev This value can overflow the uint256
    function feeGrowthGlobal0X128() external view returns (uint256);

    /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool
    /// @dev This value can overflow the uint256
    function feeGrowthGlobal1X128() external view returns (uint256);

    /// @notice The amounts of token0 and token1 that are owed to the protocol
    /// @dev Protocol fees will never exceed uint128 max in either token
    function protocolFees() external view returns (uint128 token0, uint128 token1);

    /// @notice The currently in range liquidity available to the pool
    /// @dev This value has no relationship to the total liquidity across all ticks
    function liquidity() external view returns (uint128);

    /// @notice Look up information about a specific tick in the pool
    /// @param tick The tick to look up
    /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or
    /// tick upper,
    /// liquidityNet how much liquidity changes when the pool price crosses the tick,
    /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,
    /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,
    /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick
    /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,
    /// secondsOutside the seconds spent on the other side of the tick from the current tick,
    /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.
    /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.
    /// In addition, these values are only relative and must be used only in comparison to previous snapshots for
    /// a specific position.
    function ticks(int24 tick)
        external
        view
        returns (
            uint128 liquidityGross,
            int128 liquidityNet,
            uint256 feeGrowthOutside0X128,
            uint256 feeGrowthOutside1X128,
            int56 tickCumulativeOutside,
            uint160 secondsPerLiquidityOutsideX128,
            uint32 secondsOutside,
            bool initialized
        );

    /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information
    function tickBitmap(int16 wordPosition) external view returns (uint256);

    /// @notice Returns the information about a position by the position's key
    /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper
    /// @return _liquidity The amount of liquidity in the position,
    /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,
    /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,
    /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,
    /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke
    function positions(bytes32 key)
        external
        view
        returns (
            uint128 _liquidity,
            uint256 feeGrowthInside0LastX128,
            uint256 feeGrowthInside1LastX128,
            uint128 tokensOwed0,
            uint128 tokensOwed1
        );

    /// @notice Returns data about a specific observation index
    /// @param index The element of the observations array to fetch
    /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time
    /// ago, rather than at a specific index in the array.
    /// @return blockTimestamp The timestamp of the observation,
    /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,
    /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,
    /// Returns initialized whether the observation has been initialized and the values are safe to use
    function observations(uint256 index)
        external
        view
        returns (
            uint32 blockTimestamp,
            int56 tickCumulative,
            uint160 secondsPerLiquidityCumulativeX128,
            bool initialized
        );
}

File 24 of 30: LowGasSafeMath.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.0;

/// @title Optimized overflow and underflow safe math operations
/// @notice Contains methods for doing math operations that revert on overflow or underflow for minimal gas cost
library LowGasSafeMath {
    /// @notice Returns x + y, reverts if sum overflows uint256
    /// @param x The augend
    /// @param y The addend
    /// @return z The sum of x and y
    function add(uint256 x, uint256 y) internal pure returns (uint256 z) {
        require((z = x + y) >= x);
    }

    /// @notice Returns x - y, reverts if underflows
    /// @param x The minuend
    /// @param y The subtrahend
    /// @return z The difference of x and y
    function sub(uint256 x, uint256 y) internal pure returns (uint256 z) {
        require((z = x - y) <= x);
    }

    /// @notice Returns x * y, reverts if overflows
    /// @param x The multiplicand
    /// @param y The multiplier
    /// @return z The product of x and y
    function mul(uint256 x, uint256 y) internal pure returns (uint256 z) {
        require(x == 0 || (z = x * y) / x == y);
    }

    /// @notice Returns x + y, reverts if overflows or underflows
    /// @param x The augend
    /// @param y The addend
    /// @return z The sum of x and y
    function add(int256 x, int256 y) internal pure returns (int256 z) {
        require((z = x + y) >= x == (y >= 0));
    }

    /// @notice Returns x - y, reverts if overflows or underflows
    /// @param x The minuend
    /// @param y The subtrahend
    /// @return z The difference of x and y
    function sub(int256 x, int256 y) internal pure returns (int256 z) {
        require((z = x - y) <= x == (y >= 0));
    }
}

File 25 of 30: PoolAddress.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Provides functions for deriving a pool address from the factory, tokens, and the fee
library PoolAddress {
    bytes32 internal constant POOL_INIT_CODE_HASH =
        0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54;

    /// @notice The identifying key of the pool
    struct PoolKey {
        address token0;
        address token1;
        uint24 fee;
    }

    /// @notice Returns PoolKey: the ordered tokens with the matched fee levels
    /// @param tokenA The first token of a pool, unsorted
    /// @param tokenB The second token of a pool, unsorted
    /// @param fee The fee level of the pool
    /// @return Poolkey The pool details with ordered token0 and token1 assignments
    function getPoolKey(
        address tokenA,
        address tokenB,
        uint24 fee
    ) internal pure returns (PoolKey memory) {
        if (tokenA > tokenB) (tokenA, tokenB) = (tokenB, tokenA);
        return PoolKey({token0: tokenA, token1: tokenB, fee: fee});
    }

    /// @notice Deterministically computes the pool address given the factory and PoolKey
    /// @param factory The Uniswap V3 factory contract address
    /// @param key The PoolKey
    /// @return pool The contract address of the V3 pool
    function computeAddress(address factory, PoolKey memory key)
        internal
        pure
        returns (address pool)
    {
        require(key.token0 < key.token1);
        pool = address(
            uint160(
                uint256(
                    keccak256(
                        abi.encodePacked(
                            hex"ff",
                            factory,
                            keccak256(
                                abi.encode(key.token0, key.token1, key.fee)
                            ),
                            POOL_INIT_CODE_HASH
                        )
                    )
                )
            )
        );
    }
}

File 26 of 30: SafeCast.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Safe casting methods
/// @notice Contains methods for safely casting between types
library SafeCast {
    /// @notice Cast a uint256 to a uint160, revert on overflow
    /// @param y The uint256 to be downcasted
    /// @return z The downcasted integer, now type uint160
    function toUint160(uint256 y) internal pure returns (uint160 z) {
        require((z = uint160(y)) == y);
    }

    /// @notice Cast a int256 to a int128, revert on overflow or underflow
    /// @param y The int256 to be downcasted
    /// @return z The downcasted integer, now type int128
    function toInt128(int256 y) internal pure returns (int128 z) {
        require((z = int128(y)) == y);
    }

    /// @notice Cast a uint256 to a int256, revert on overflow
    /// @param y The uint256 to be casted
    /// @return z The casted integer, now type int256
    function toInt256(uint256 y) internal pure returns (int256 z) {
        require(y < 2**255);
        z = int256(y);
    }
}

File 27 of 30: SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");

        return c;
    }

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

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     * - Subtraction cannot overflow.
     *
     * _Available since v2.4.0._
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        uint256 c = a - b;

        return c;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");

        return c;
    }

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

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     *
     * _Available since v2.4.0._
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        // Solidity only automatically asserts when dividing by 0
        require(b > 0, errorMessage);
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

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

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts with custom message when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     *
     * _Available since v2.4.0._
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }

    
    function sqrt(uint256 x) internal pure returns (uint256 y) {
        uint256 z = (x + 1) / 2;
        y = x;
        while (z < y) {
            y = z;
            z = (x / z + z) / 2;
        }
    }
}

File 28 of 30: SqrtPriceMath.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.5.0;

import './LowGasSafeMath.sol';
import './SafeCast.sol';

import './FullMath.sol';
import './UnsafeMath.sol';
import './FixedPoint96.sol';

/// @title Functions based on Q64.96 sqrt price and liquidity
/// @notice Contains the math that uses square root of price as a Q64.96 and liquidity to compute deltas
library SqrtPriceMath {
    using LowGasSafeMath for uint256;
    using SafeCast for uint256;

    /// @notice Gets the next sqrt price given a delta of token0
    /// @dev Always rounds up, because in the exact output case (increasing price) we need to move the price at least
    /// far enough to get the desired output amount, and in the exact input case (decreasing price) we need to move the
    /// price less in order to not send too much output.
    /// The most precise formula for this is liquidity * sqrtPX96 / (liquidity +- amount * sqrtPX96),
    /// if this is impossible because of overflow, we calculate liquidity / (liquidity / sqrtPX96 +- amount).
    /// @param sqrtPX96 The starting price, i.e. before accounting for the token0 delta
    /// @param liquidity The amount of usable liquidity
    /// @param amount How much of token0 to add or remove from virtual reserves
    /// @param add Whether to add or remove the amount of token0
    /// @return The price after adding or removing amount, depending on add
    function getNextSqrtPriceFromAmount0RoundingUp(
        uint160 sqrtPX96,
        uint128 liquidity,
        uint256 amount,
        bool add
    ) internal pure returns (uint160) {
        // we short circuit amount == 0 because the result is otherwise not guaranteed to equal the input price
        if (amount == 0) return sqrtPX96;
        uint256 numerator1 = uint256(liquidity) << FixedPoint96.RESOLUTION;

        if (add) {
            uint256 product;
            if ((product = amount * sqrtPX96) / amount == sqrtPX96) {
                uint256 denominator = numerator1 + product;
                if (denominator >= numerator1)
                    // always fits in 160 bits
                    return uint160(FullMath.mulDivRoundingUp(numerator1, sqrtPX96, denominator));
            }

            return uint160(UnsafeMath.divRoundingUp(numerator1, (numerator1 / sqrtPX96).add(amount)));
        } else {
            uint256 product;
            // if the product overflows, we know the denominator underflows
            // in addition, we must check that the denominator does not underflow
            require((product = amount * sqrtPX96) / amount == sqrtPX96 && numerator1 > product);
            uint256 denominator = numerator1 - product;
            return FullMath.mulDivRoundingUp(numerator1, sqrtPX96, denominator).toUint160();
        }
    }

    /// @notice Gets the next sqrt price given a delta of token1
    /// @dev Always rounds down, because in the exact output case (decreasing price) we need to move the price at least
    /// far enough to get the desired output amount, and in the exact input case (increasing price) we need to move the
    /// price less in order to not send too much output.
    /// The formula we compute is within <1 wei of the lossless version: sqrtPX96 +- amount / liquidity
    /// @param sqrtPX96 The starting price, i.e., before accounting for the token1 delta
    /// @param liquidity The amount of usable liquidity
    /// @param amount How much of token1 to add, or remove, from virtual reserves
    /// @param add Whether to add, or remove, the amount of token1
    /// @return The price after adding or removing `amount`
    function getNextSqrtPriceFromAmount1RoundingDown(
        uint160 sqrtPX96,
        uint128 liquidity,
        uint256 amount,
        bool add
    ) internal pure returns (uint160) {
        // if we're adding (subtracting), rounding down requires rounding the quotient down (up)
        // in both cases, avoid a mulDiv for most inputs
        if (add) {
            uint256 quotient = (
                amount <= type(uint160).max
                    ? (amount << FixedPoint96.RESOLUTION) / liquidity
                    : FullMath.mulDiv(amount, FixedPoint96.Q96, liquidity)
            );

            return uint256(sqrtPX96).add(quotient).toUint160();
        } else {
            uint256 quotient = (
                amount <= type(uint160).max
                    ? UnsafeMath.divRoundingUp(amount << FixedPoint96.RESOLUTION, liquidity)
                    : FullMath.mulDivRoundingUp(amount, FixedPoint96.Q96, liquidity)
            );

            require(sqrtPX96 > quotient);
            // always fits 160 bits
            return uint160(sqrtPX96 - quotient);
        }
    }

    /// @notice Gets the next sqrt price given an input amount of token0 or token1
    /// @dev Throws if price or liquidity are 0, or if the next price is out of bounds
    /// @param sqrtPX96 The starting price, i.e., before accounting for the input amount
    /// @param liquidity The amount of usable liquidity
    /// @param amountIn How much of token0, or token1, is being swapped in
    /// @param zeroForOne Whether the amount in is token0 or token1
    /// @return sqrtQX96 The price after adding the input amount to token0 or token1
    function getNextSqrtPriceFromInput(
        uint160 sqrtPX96,
        uint128 liquidity,
        uint256 amountIn,
        bool zeroForOne
    ) internal pure returns (uint160 sqrtQX96) {
        require(sqrtPX96 > 0);
        require(liquidity > 0);

        // round to make sure that we don't pass the target price
        return
            zeroForOne
                ? getNextSqrtPriceFromAmount0RoundingUp(sqrtPX96, liquidity, amountIn, true)
                : getNextSqrtPriceFromAmount1RoundingDown(sqrtPX96, liquidity, amountIn, true);
    }

    /// @notice Gets the next sqrt price given an output amount of token0 or token1
    /// @dev Throws if price or liquidity are 0 or the next price is out of bounds
    /// @param sqrtPX96 The starting price before accounting for the output amount
    /// @param liquidity The amount of usable liquidity
    /// @param amountOut How much of token0, or token1, is being swapped out
    /// @param zeroForOne Whether the amount out is token0 or token1
    /// @return sqrtQX96 The price after removing the output amount of token0 or token1
    function getNextSqrtPriceFromOutput(
        uint160 sqrtPX96,
        uint128 liquidity,
        uint256 amountOut,
        bool zeroForOne
    ) internal pure returns (uint160 sqrtQX96) {
        require(sqrtPX96 > 0);
        require(liquidity > 0);

        // round to make sure that we pass the target price
        return
            zeroForOne
                ? getNextSqrtPriceFromAmount1RoundingDown(sqrtPX96, liquidity, amountOut, false)
                : getNextSqrtPriceFromAmount0RoundingUp(sqrtPX96, liquidity, amountOut, false);
    }

    /// @notice Gets the amount0 delta between two prices
    /// @dev Calculates liquidity / sqrt(lower) - liquidity / sqrt(upper),
    /// i.e. liquidity * (sqrt(upper) - sqrt(lower)) / (sqrt(upper) * sqrt(lower))
    /// @param sqrtRatioAX96 A sqrt price
    /// @param sqrtRatioBX96 Another sqrt price
    /// @param liquidity The amount of usable liquidity
    /// @param roundUp Whether to round the amount up or down
    /// @return amount0 Amount of token0 required to cover a position of size liquidity between the two passed prices
    function getAmount0Delta(
        uint160 sqrtRatioAX96,
        uint160 sqrtRatioBX96,
        uint128 liquidity,
        bool roundUp
    ) internal pure returns (uint256 amount0) {
        if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);

        uint256 numerator1 = uint256(liquidity) << FixedPoint96.RESOLUTION;
        uint256 numerator2 = sqrtRatioBX96 - sqrtRatioAX96;

        require(sqrtRatioAX96 > 0);

        return
            roundUp
                ? UnsafeMath.divRoundingUp(
                    FullMath.mulDivRoundingUp(numerator1, numerator2, sqrtRatioBX96),
                    sqrtRatioAX96
                )
                : FullMath.mulDiv(numerator1, numerator2, sqrtRatioBX96) / sqrtRatioAX96;
    }

    /// @notice Gets the amount1 delta between two prices
    /// @dev Calculates liquidity * (sqrt(upper) - sqrt(lower))
    /// @param sqrtRatioAX96 A sqrt price
    /// @param sqrtRatioBX96 Another sqrt price
    /// @param liquidity The amount of usable liquidity
    /// @param roundUp Whether to round the amount up, or down
    /// @return amount1 Amount of token1 required to cover a position of size liquidity between the two passed prices
    function getAmount1Delta(
        uint160 sqrtRatioAX96,
        uint160 sqrtRatioBX96,
        uint128 liquidity,
        bool roundUp
    ) internal pure returns (uint256 amount1) {
        if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);

        return
            roundUp
                ? FullMath.mulDivRoundingUp(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96)
                : FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);
    }

    /// @notice Helper that gets signed token0 delta
    /// @param sqrtRatioAX96 A sqrt price
    /// @param sqrtRatioBX96 Another sqrt price
    /// @param liquidity The change in liquidity for which to compute the amount0 delta
    /// @return amount0 Amount of token0 corresponding to the passed liquidityDelta between the two prices
    function getAmount0Delta(
        uint160 sqrtRatioAX96,
        uint160 sqrtRatioBX96,
        int128 liquidity
    ) internal pure returns (int256 amount0) {
        return
            liquidity < 0
                ? -getAmount0Delta(sqrtRatioAX96, sqrtRatioBX96, uint128(-liquidity), false).toInt256()
                : getAmount0Delta(sqrtRatioAX96, sqrtRatioBX96, uint128(liquidity), true).toInt256();
    }

    /// @notice Helper that gets signed token1 delta
    /// @param sqrtRatioAX96 A sqrt price
    /// @param sqrtRatioBX96 Another sqrt price
    /// @param liquidity The change in liquidity for which to compute the amount1 delta
    /// @return amount1 Amount of token1 corresponding to the passed liquidityDelta between the two prices
    function getAmount1Delta(
        uint160 sqrtRatioAX96,
        uint160 sqrtRatioBX96,
        int128 liquidity
    ) internal pure returns (int256 amount1) {
        return
            liquidity < 0
                ? -getAmount1Delta(sqrtRatioAX96, sqrtRatioBX96, uint128(-liquidity), false).toInt256()
                : getAmount1Delta(sqrtRatioAX96, sqrtRatioBX96, uint128(liquidity), true).toInt256();
    }
}

File 29 of 30: TickMath.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity 0.8.16;

/// @title Math library for computing sqrt prices from ticks and vice versa
/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports
/// prices between 2**-128 and 2**128
library TickMath {
    /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128
    int24 internal constant MIN_TICK = -887272;
    /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128
    int24 internal constant MAX_TICK = -MIN_TICK;

    /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)
    uint160 internal constant MIN_SQRT_RATIO = 4295128739;
    /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)
    uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;

    /// @notice Calculates sqrt(1.0001^tick) * 2^96
    /// @dev Throws if |tick| > max tick
    /// @param tick The input tick for the above formula
    /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)
    /// at the given tick
    function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {
        uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));
        require(int256(absTick) <= int256(MAX_TICK), 'T');

        uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;
        if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;
        if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;
        if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;
        if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;
        if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;
        if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;
        if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;
        if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;
        if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;
        if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;
        if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;
        if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;
        if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;
        if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;
        if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;
        if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;
        if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;
        if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;
        if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;

        if (tick > 0) ratio = type(uint256).max / ratio;

        // this divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.
        // we then downcast because we know the result always fits within 160 bits due to our tick input constraint
        // we round up in the division so getTickAtSqrtRatio of the output price is always consistent
        sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));
    }

    /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio
    /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may
    /// ever return.
    /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96
    /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio
    function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {
        // second inequality must be < because the price can never reach the price at the max tick
        require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R');
        uint256 ratio = uint256(sqrtPriceX96) << 32;

        uint256 r = ratio;
        uint256 msb = 0;

        assembly {
            let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))
            msb := or(msb, f)
            r := shr(f, r)
        }
        assembly {
            let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))
            msb := or(msb, f)
            r := shr(f, r)
        }
        assembly {
            let f := shl(5, gt(r, 0xFFFFFFFF))
            msb := or(msb, f)
            r := shr(f, r)
        }
        assembly {
            let f := shl(4, gt(r, 0xFFFF))
            msb := or(msb, f)
            r := shr(f, r)
        }
        assembly {
            let f := shl(3, gt(r, 0xFF))
            msb := or(msb, f)
            r := shr(f, r)
        }
        assembly {
            let f := shl(2, gt(r, 0xF))
            msb := or(msb, f)
            r := shr(f, r)
        }
        assembly {
            let f := shl(1, gt(r, 0x3))
            msb := or(msb, f)
            r := shr(f, r)
        }
        assembly {
            let f := gt(r, 0x1)
            msb := or(msb, f)
        }

        if (msb >= 128) r = ratio >> (msb - 127);
        else r = ratio << (127 - msb);

        int256 log_2 = (int256(msb) - 128) << 64;

        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(63, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(62, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(61, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(60, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(59, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(58, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(57, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(56, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(55, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(54, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(53, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(52, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(51, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(50, f))
        }

        int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number

        int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);
        int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);

        tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;
    }
}

File 30 of 30: UnsafeMath.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Math functions that do not check inputs or outputs
/// @notice Contains methods that perform common math functions but do not do any overflow or underflow checks
library UnsafeMath {
    /// @notice Returns ceil(x / y)
    /// @dev division by 0 has unspecified behavior, and must be checked externally
    /// @param x The dividend
    /// @param y The divisor
    /// @return z The quotient, ceil(x / y)
    function divRoundingUp(uint256 x, uint256 y) internal pure returns (uint256 z) {
        assembly {
            z := add(div(x, y), gt(mod(x, y), 0))
        }
    }
}

Contract ABI

[{"inputs":[{"internalType":"address","name":"_sweep_address","type":"address"},{"internalType":"address","name":"_usdc_address","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"SWEEP","outputs":[{"internalType":"contract ISweep","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"USDX","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"amountToPeg_UsingConstantProduct","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"amountToPeg_UsingTicks","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int24","name":"tick","type":"int24"},{"internalType":"uint128","name":"baseAmount","type":"uint128"},{"internalType":"address","name":"baseToken","type":"address"},{"internalType":"address","name":"quoteToken","type":"address"}],"name":"getQuoteAtTick","outputs":[{"internalType":"uint256","name":"quoteAmount","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_price","type":"uint256"},{"internalType":"uint256","name":"_decimals","type":"uint256"}],"name":"getTickFromPrice","outputs":[{"internalType":"int24","name":"_tick","type":"int24"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"nonfungiblePositionManager","outputs":[{"internalType":"contract INonfungiblePositionManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"uniswap_factory","outputs":[{"internalType":"contract IUniswapV3Factory","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60806040523480156200001157600080fd5b506040516200212438038062002124833981016040819052620000349162000086565b600080546001600160a01b039283166001600160a01b03199182161790915560018054939092169216919091179055620000be565b80516001600160a01b03811681146200008157600080fd5b919050565b600080604083850312156200009a57600080fd5b620000a58362000069565b9150620000b56020840162000069565b90509250929050565b61205680620000ce6000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c80639d57137f1161005b5780639d57137f146101135780639dc82bbd14610133578063b44a272214610159578063b98d1fe21461017457600080fd5b806343c57a271461008d57806359cb9fec146100b357806366309211146100f8578063694803ec14610100575b600080fd5b6100a061009b36600461185e565b61018f565b6040519081526020015b60405180910390f35b6000546100d39073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100aa565b6100a0610369565b6100a061010e3660046118ba565b610716565b6001546100d39073ffffffffffffffffffffffffffffffffffffffff1681565b6101466101413660046118d3565b610a22565b60405160029190910b81526020016100aa565b6100d373c36442b4a4522e871399cd717abdd847ab11fe8881565b6100d3731f98431c8ad98523631ae4a59f267346ea31f98481565b60008061019b86610aa1565b90506fffffffffffffffffffffffffffffffff73ffffffffffffffffffffffffffffffffffffffff82161161029a5760006101ec73ffffffffffffffffffffffffffffffffffffffff831680611924565b90508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161061025c576102577801000000000000000000000000000000000000000000000000876fffffffffffffffffffffffffffffffff1683610f43565b610292565b61029281876fffffffffffffffffffffffffffffffff167801000000000000000000000000000000000000000000000000610f43565b925050610360565b60006102c673ffffffffffffffffffffffffffffffffffffffff83168068010000000000000000610f43565b90508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161061032e57610329700100000000000000000000000000000000876fffffffffffffffffffffffffffffffff1683610f43565b61035c565b61035c81876fffffffffffffffffffffffffffffffff16700100000000000000000000000000000000610f43565b9250505b50949350505050565b600154600080546040517f1698ee8200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff938416600482015292166024830152610bb86044830152908190731f98431c8ad98523631ae4a59f267346ea31f98490631698ee8290606401602060405180830381865afa158015610401573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610425919061196c565b6001546040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8084166004830152929350839260009216906370a0823190602401602060405180830381865afa15801561049b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104bf9190611989565b600080546040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8781166004830152939450919216906370a0823190602401602060405180830381865afa158015610533573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105579190611989565b90506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f4f3641e6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ec9190611989565b90506000826105fb8584611924565b6106059190611924565b61061290620f4240611924565b9050600061061f82611017565b905060008582116106395761063482876119a2565b610643565b61064386836119a2565b90506103e8610654826103e5611924565b61065e91906119e4565b905060008773ffffffffffffffffffffffffffffffffffffffff16633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa1580156106ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d19190611a15565b50506001546000549496506107089550869488945073ffffffffffffffffffffffffffffffffffffffff918216935016905061018f565b995050505050505050505090565b600154600080546040517f1698ee8200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff938416600482015292166024830152610bb86044830152908190731f98431c8ad98523631ae4a59f267346ea31f98490631698ee8290606401602060405180830381865afa1580156107ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d2919061196c565b9050600081905060008173ffffffffffffffffffffffffffffffffffffffff16633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa158015610826573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061084a9190611a15565b50506040517f99fbab88000000000000000000000000000000000000000000000000000000008152600481018b905293955060009450849373c36442b4a4522e871399cd717abdd847ab11fe8893506399fbab889250602401905061018060405180830381865afa1580156108c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108e79190611ad0565b50505050975050965050505050506000610992600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f4f3641e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610967573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098b9190611989565b6012610a22565b905060006d04ee2d6d415b85acef81000000006109bc8562ffffff168762ffffff16866001611070565b6109c691906119e4565b905060006d04ee2d6d415b85acef81000000006109f08662ffffff168562ffffff16876001611070565b6109fa91906119e4565b9050818111610a0a576000610a14565b610a1482826119a2565b9a9950505050505050505050565b6000603c81610a3a610a3585600a611cd1565b6111a1565b90506000610a47866111a1565b90506000610a5583836111bf565b9050610a7f610a6660406060611cdd565b60ff16610a7283611241565b600f0b901b600f0b611263565b945083610a8c8187611cf6565b610a969190611d6a565b979650505050505050565b60008060008360020b12610ab8578260020b610ac5565b8260020b610ac590611e13565b9050610af07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff27618611e4b565b60020b811315610b61576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600160248201527f540000000000000000000000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b600081600116600003610b8557700100000000000000000000000000000000610b97565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff1690506002821615610bd6576080610bd1826ffff97272373d413259a46990580e213a611924565b901c90505b6004821615610c00576080610bfb826ffff2e50f5f656932ef12357cf3c7fdcc611924565b901c90505b6008821615610c2a576080610c25826fffe5caca7e10e4e61c3624eaa0941cd0611924565b901c90505b6010821615610c54576080610c4f826fffcb9843d60f6159c9db58835c926644611924565b901c90505b6020821615610c7e576080610c79826fff973b41fa98c081472e6896dfb254c0611924565b901c90505b6040821615610ca8576080610ca3826fff2ea16466c96a3843ec78b326b52861611924565b901c90505b6080821615610cd2576080610ccd826ffe5dee046a99a2a811c461f1969c3053611924565b901c90505b610100821615610cfd576080610cf8826ffcbe86c7900a88aedcffc83b479aa3a4611924565b901c90505b610200821615610d28576080610d23826ff987a7253ac413176f2b074cf7815e54611924565b901c90505b610400821615610d53576080610d4e826ff3392b0822b70005940c7a398e4b70f3611924565b901c90505b610800821615610d7e576080610d79826fe7159475a2c29b7443b29c7fa6e889d9611924565b901c90505b611000821615610da9576080610da4826fd097f3bdfd2022b8845ad8f792aa5825611924565b901c90505b612000821615610dd4576080610dcf826fa9f746462d870fdf8a65dc1f90e061e5611924565b901c90505b614000821615610dff576080610dfa826f70d869a156d2a1b890bb3df62baf32f7611924565b901c90505b618000821615610e2a576080610e25826f31be135f97d08fd981231505542fcfa6611924565b901c90505b62010000821615610e56576080610e51826f09aa508b5b7a84e1c677de54f3e99bc9611924565b901c90505b62020000821615610e81576080610e7c826e5d6af8dedb81196699c329225ee604611924565b901c90505b62040000821615610eab576080610ea6826d2216e584f5fa1ea926041bedfe98611924565b901c90505b62080000821615610ed3576080610ece826b048a170391f7dc42444e8fa2611924565b901c90505b60008460020b1315610f0c57610f09817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119e4565b90505b610f1b64010000000082611e89565b15610f27576001610f2a565b60005b610f3b9060ff16602083901c611e9d565b949350505050565b600080807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff85870985870292508281108382030391505080600003610fa85760008411610f8f57600080fd5b838281610f9e57610f9e6119b5565b0492505050611010565b600084868809851960019081018716968790049682860381900495909211909303600082900391909104909201919091029190911760038402600290811880860282030280860282030280860282030280860282030280860282030280860290910302029150505b9392505050565b6000806002611027846001611e9d565b61103191906119e4565b90508291505b8181101561106a5790508060028161104f81866119e4565b6110599190611e9d565b61106391906119e4565b9050611037565b50919050565b60008373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1611156110aa579293925b7bffffffffffffffffffffffffffffffff000000000000000000000000606084901b1660006110d98787611eb0565b73ffffffffffffffffffffffffffffffffffffffff16905060008773ffffffffffffffffffffffffffffffffffffffff161161111457600080fd5b8361115b578673ffffffffffffffffffffffffffffffffffffffff1661115183838973ffffffffffffffffffffffffffffffffffffffff16610f43565b61032991906119e4565b61035c61117f83838973ffffffffffffffffffffffffffffffffffffffff1661161d565b8873ffffffffffffffffffffffffffffffffffffffff16808204910615150190565b6000677fffffffffffffff8211156111b857600080fd5b5060401b90565b600081600f0b6000036111d157600080fd5b600082600f0b604085600f0b901b816111ec576111ec6119b5565b0590507fffffffffffffffffffffffffffffffff80000000000000000000000000000000811280159061122f57506f7fffffffffffffffffffffffffffffff8113155b61123857600080fd5b90505b92915050565b60008082600f0b121561125357600080fd5b61123b604083600f0b901b611684565b60006401000276a373ffffffffffffffffffffffffffffffffffffffff8316108015906112b9575073fffd8963efd1fc6a506488495d951d5263988d2673ffffffffffffffffffffffffffffffffffffffff8316105b61131f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600160248201527f52000000000000000000000000000000000000000000000000000000000000006044820152606401610b58565b77ffffffffffffffffffffffffffffffffffffffff00000000602083901b166fffffffffffffffffffffffffffffffff811160071b81811c67ffffffffffffffff811160061b90811c63ffffffff811160051b90811c61ffff811160041b90811c60ff8111600390811b91821c600f811160021b90811c918211600190811b92831c979088119617909417909217179091171717608081106113d0576113c6607f826119a2565b83901c91506113e1565b6113db81607f6119a2565b83901b91505b600060406113f0608084611ee4565b901b9050828302607f1c92508260801c80603f1b8217915083811c935050828302607f1c92508260801c80603e1b8217915083811c935050828302607f1c92508260801c80603d1b8217915083811c935050828302607f1c92508260801c80603c1b8217915083811c935050828302607f1c92508260801c80603b1b8217915083811c935050828302607f1c92508260801c80603a1b8217915083811c935050828302607f1c92508260801c8060391b8217915083811c935050828302607f1c92508260801c8060381b8217915083811c935050828302607f1c92508260801c8060371b8217915083811c935050828302607f1c92508260801c8060361b8217915083811c935050828302607f1c92508260801c8060351b8217915083811c935050828302607f1c92508260801c8060341b8217915083811c935050828302607f1c92508260801c8060331b8217915083811c935050828302607f1c92508260801c8060321b8217915050600081693627a301d71055774c856115739190611f04565b9050600060806115936f028f6481ab7f045a5af012a19d003aaa84611ee4565b901d9050600060806115b5846fdb2df09e81959a81455e260799a0632f611fc0565b901d90508060020b8260020b1461160e578873ffffffffffffffffffffffffffffffffffffffff166115e682610aa1565b73ffffffffffffffffffffffffffffffffffffffff1611156116085781611610565b80611610565b815b9998505050505050505050565b600061162a848484610f43565b90506000828061163c5761163c6119b5565b8486091115611010577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811061167157600080fd5b8061167b81611fe8565b95945050505050565b60008160000361169657506000919050565b81600170010000000000000000000000000000000082106116bc5760809190911c9060401b5b6801000000000000000082106116d75760409190911c9060201b5b64010000000082106116ee5760209190911c9060101b5b6201000082106117035760109190911c9060081b5b61010082106117175760089190911c9060041b5b6010821061172a5760049190911c9060021b5b600482106117365760011b5b6001818581611747576117476119b5565b048201901c9050600181858161175f5761175f6119b5565b048201901c90506001818581611777576117776119b5565b048201901c9050600181858161178f5761178f6119b5565b048201901c905060018185816117a7576117a76119b5565b048201901c905060018185816117bf576117bf6119b5565b048201901c905060018185816117d7576117d76119b5565b048201901c905060008185816117ef576117ef6119b5565b0490508082106117ff578061167b565b509392505050565b919050565b8060020b811461181b57600080fd5b50565b6fffffffffffffffffffffffffffffffff8116811461181b57600080fd5b73ffffffffffffffffffffffffffffffffffffffff8116811461181b57600080fd5b6000806000806080858703121561187457600080fd5b843561187f8161180c565b9350602085013561188f8161181e565b9250604085013561189f8161183c565b915060608501356118af8161183c565b939692955090935050565b6000602082840312156118cc57600080fd5b5035919050565b600080604083850312156118e657600080fd5b50508035926020909101359150565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561195c5761195c6118f5565b500290565b80516118078161183c565b60006020828403121561197e57600080fd5b81516112388161183c565b60006020828403121561199b57600080fd5b5051919050565b8181038181111561123b5761123b6118f5565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000826119f3576119f36119b5565b500490565b80516118078161180c565b805161ffff8116811461180757600080fd5b600080600080600080600060e0888a031215611a3057600080fd5b8751611a3b8161183c565b6020890151909750611a4c8161180c565b9550611a5a60408901611a03565b9450611a6860608901611a03565b9350611a7660808901611a03565b925060a088015160ff81168114611a8c57600080fd5b60c08901519092508015158114611aa257600080fd5b8091505092959891949750929550565b805162ffffff8116811461180757600080fd5b80516118078161181e565b6000806000806000806000806000806000806101808d8f031215611af357600080fd5b8c516bffffffffffffffffffffffff81168114611b0f57600080fd5b9b50611b1d60208e01611961565b9a50611b2b60408e01611961565b9950611b3960608e01611961565b9850611b4760808e01611ab2565b9750611b5560a08e016119f8565b9650611b6360c08e016119f8565b9550611b7160e08e01611ac5565b94506101008d015193506101208d01519250611b906101408e01611ac5565b9150611b9f6101608e01611ac5565b90509295989b509295989b509295989b565b600181815b80851115611c0a57817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04821115611bf057611bf06118f5565b80851615611bfd57918102915b93841c9390800290611bb6565b509250929050565b600082611c215750600161123b565b81611c2e5750600061123b565b8160018114611c445760028114611c4e57611c6a565b600191505061123b565b60ff841115611c5f57611c5f6118f5565b50506001821b61123b565b5060208310610133831016604e8410600b8410161715611c8d575081810a61123b565b611c978383611bb1565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04821115611cc957611cc96118f5565b029392505050565b60006110108383611c12565b60ff828116828216039081111561123b5761123b6118f5565b60008160020b8360020b80611d0d57611d0d6119b5565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81147fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80000083141615611d6157611d616118f5565b90059392505050565b60008160020b8360020b627fffff600082136000841383830485118282161615611d9657611d966118f5565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8000006000851286820586128184161615611dd157611dd16118f5565b60008712925085820587128484161615611ded57611ded6118f5565b85850587128184161615611e0357611e036118f5565b5050509290910295945050505050565b60007f80000000000000000000000000000000000000000000000000000000000000008203611e4457611e446118f5565b5060000390565b60008160020b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8000008103611e8057611e806118f5565b60000392915050565b600082611e9857611e986119b5565b500690565b8082018082111561123b5761123b6118f5565b73ffffffffffffffffffffffffffffffffffffffff828116828216039080821115611edd57611edd6118f5565b5092915050565b8181036000831280158383131683831282161715611edd57611edd6118f5565b60007f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600084136000841385830485118282161615611f4557611f456118f5565b7f80000000000000000000000000000000000000000000000000000000000000006000871286820588128184161615611f8057611f806118f5565b60008712925087820587128484161615611f9c57611f9c6118f5565b87850587128184161615611fb257611fb26118f5565b505050929093029392505050565b8082018281126000831280158216821582161715611fe057611fe06118f5565b505092915050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612019576120196118f5565b506001019056fea26469706673582212209ba449b7f3522a9ee538629d10b7742abadebdd4e9796f5819177c3313e776e564736f6c634300081000330000000000000000000000004f4219c9b851aebb652dd182d944a99b0b68edcf000000000000000000000000ff970a61a04b1ca14834a43f5de4533ebddb5cc8

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100885760003560e01c80639d57137f1161005b5780639d57137f146101135780639dc82bbd14610133578063b44a272214610159578063b98d1fe21461017457600080fd5b806343c57a271461008d57806359cb9fec146100b357806366309211146100f8578063694803ec14610100575b600080fd5b6100a061009b36600461185e565b61018f565b6040519081526020015b60405180910390f35b6000546100d39073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100aa565b6100a0610369565b6100a061010e3660046118ba565b610716565b6001546100d39073ffffffffffffffffffffffffffffffffffffffff1681565b6101466101413660046118d3565b610a22565b60405160029190910b81526020016100aa565b6100d373c36442b4a4522e871399cd717abdd847ab11fe8881565b6100d3731f98431c8ad98523631ae4a59f267346ea31f98481565b60008061019b86610aa1565b90506fffffffffffffffffffffffffffffffff73ffffffffffffffffffffffffffffffffffffffff82161161029a5760006101ec73ffffffffffffffffffffffffffffffffffffffff831680611924565b90508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161061025c576102577801000000000000000000000000000000000000000000000000876fffffffffffffffffffffffffffffffff1683610f43565b610292565b61029281876fffffffffffffffffffffffffffffffff167801000000000000000000000000000000000000000000000000610f43565b925050610360565b60006102c673ffffffffffffffffffffffffffffffffffffffff83168068010000000000000000610f43565b90508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161061032e57610329700100000000000000000000000000000000876fffffffffffffffffffffffffffffffff1683610f43565b61035c565b61035c81876fffffffffffffffffffffffffffffffff16700100000000000000000000000000000000610f43565b9250505b50949350505050565b600154600080546040517f1698ee8200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff938416600482015292166024830152610bb86044830152908190731f98431c8ad98523631ae4a59f267346ea31f98490631698ee8290606401602060405180830381865afa158015610401573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610425919061196c565b6001546040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8084166004830152929350839260009216906370a0823190602401602060405180830381865afa15801561049b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104bf9190611989565b600080546040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8781166004830152939450919216906370a0823190602401602060405180830381865afa158015610533573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105579190611989565b90506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f4f3641e6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ec9190611989565b90506000826105fb8584611924565b6106059190611924565b61061290620f4240611924565b9050600061061f82611017565b905060008582116106395761063482876119a2565b610643565b61064386836119a2565b90506103e8610654826103e5611924565b61065e91906119e4565b905060008773ffffffffffffffffffffffffffffffffffffffff16633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa1580156106ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d19190611a15565b50506001546000549496506107089550869488945073ffffffffffffffffffffffffffffffffffffffff918216935016905061018f565b995050505050505050505090565b600154600080546040517f1698ee8200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff938416600482015292166024830152610bb86044830152908190731f98431c8ad98523631ae4a59f267346ea31f98490631698ee8290606401602060405180830381865afa1580156107ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d2919061196c565b9050600081905060008173ffffffffffffffffffffffffffffffffffffffff16633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa158015610826573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061084a9190611a15565b50506040517f99fbab88000000000000000000000000000000000000000000000000000000008152600481018b905293955060009450849373c36442b4a4522e871399cd717abdd847ab11fe8893506399fbab889250602401905061018060405180830381865afa1580156108c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108e79190611ad0565b50505050975050965050505050506000610992600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f4f3641e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610967573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098b9190611989565b6012610a22565b905060006d04ee2d6d415b85acef81000000006109bc8562ffffff168762ffffff16866001611070565b6109c691906119e4565b905060006d04ee2d6d415b85acef81000000006109f08662ffffff168562ffffff16876001611070565b6109fa91906119e4565b9050818111610a0a576000610a14565b610a1482826119a2565b9a9950505050505050505050565b6000603c81610a3a610a3585600a611cd1565b6111a1565b90506000610a47866111a1565b90506000610a5583836111bf565b9050610a7f610a6660406060611cdd565b60ff16610a7283611241565b600f0b901b600f0b611263565b945083610a8c8187611cf6565b610a969190611d6a565b979650505050505050565b60008060008360020b12610ab8578260020b610ac5565b8260020b610ac590611e13565b9050610af07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff27618611e4b565b60020b811315610b61576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600160248201527f540000000000000000000000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b600081600116600003610b8557700100000000000000000000000000000000610b97565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff1690506002821615610bd6576080610bd1826ffff97272373d413259a46990580e213a611924565b901c90505b6004821615610c00576080610bfb826ffff2e50f5f656932ef12357cf3c7fdcc611924565b901c90505b6008821615610c2a576080610c25826fffe5caca7e10e4e61c3624eaa0941cd0611924565b901c90505b6010821615610c54576080610c4f826fffcb9843d60f6159c9db58835c926644611924565b901c90505b6020821615610c7e576080610c79826fff973b41fa98c081472e6896dfb254c0611924565b901c90505b6040821615610ca8576080610ca3826fff2ea16466c96a3843ec78b326b52861611924565b901c90505b6080821615610cd2576080610ccd826ffe5dee046a99a2a811c461f1969c3053611924565b901c90505b610100821615610cfd576080610cf8826ffcbe86c7900a88aedcffc83b479aa3a4611924565b901c90505b610200821615610d28576080610d23826ff987a7253ac413176f2b074cf7815e54611924565b901c90505b610400821615610d53576080610d4e826ff3392b0822b70005940c7a398e4b70f3611924565b901c90505b610800821615610d7e576080610d79826fe7159475a2c29b7443b29c7fa6e889d9611924565b901c90505b611000821615610da9576080610da4826fd097f3bdfd2022b8845ad8f792aa5825611924565b901c90505b612000821615610dd4576080610dcf826fa9f746462d870fdf8a65dc1f90e061e5611924565b901c90505b614000821615610dff576080610dfa826f70d869a156d2a1b890bb3df62baf32f7611924565b901c90505b618000821615610e2a576080610e25826f31be135f97d08fd981231505542fcfa6611924565b901c90505b62010000821615610e56576080610e51826f09aa508b5b7a84e1c677de54f3e99bc9611924565b901c90505b62020000821615610e81576080610e7c826e5d6af8dedb81196699c329225ee604611924565b901c90505b62040000821615610eab576080610ea6826d2216e584f5fa1ea926041bedfe98611924565b901c90505b62080000821615610ed3576080610ece826b048a170391f7dc42444e8fa2611924565b901c90505b60008460020b1315610f0c57610f09817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119e4565b90505b610f1b64010000000082611e89565b15610f27576001610f2a565b60005b610f3b9060ff16602083901c611e9d565b949350505050565b600080807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff85870985870292508281108382030391505080600003610fa85760008411610f8f57600080fd5b838281610f9e57610f9e6119b5565b0492505050611010565b600084868809851960019081018716968790049682860381900495909211909303600082900391909104909201919091029190911760038402600290811880860282030280860282030280860282030280860282030280860282030280860290910302029150505b9392505050565b6000806002611027846001611e9d565b61103191906119e4565b90508291505b8181101561106a5790508060028161104f81866119e4565b6110599190611e9d565b61106391906119e4565b9050611037565b50919050565b60008373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1611156110aa579293925b7bffffffffffffffffffffffffffffffff000000000000000000000000606084901b1660006110d98787611eb0565b73ffffffffffffffffffffffffffffffffffffffff16905060008773ffffffffffffffffffffffffffffffffffffffff161161111457600080fd5b8361115b578673ffffffffffffffffffffffffffffffffffffffff1661115183838973ffffffffffffffffffffffffffffffffffffffff16610f43565b61032991906119e4565b61035c61117f83838973ffffffffffffffffffffffffffffffffffffffff1661161d565b8873ffffffffffffffffffffffffffffffffffffffff16808204910615150190565b6000677fffffffffffffff8211156111b857600080fd5b5060401b90565b600081600f0b6000036111d157600080fd5b600082600f0b604085600f0b901b816111ec576111ec6119b5565b0590507fffffffffffffffffffffffffffffffff80000000000000000000000000000000811280159061122f57506f7fffffffffffffffffffffffffffffff8113155b61123857600080fd5b90505b92915050565b60008082600f0b121561125357600080fd5b61123b604083600f0b901b611684565b60006401000276a373ffffffffffffffffffffffffffffffffffffffff8316108015906112b9575073fffd8963efd1fc6a506488495d951d5263988d2673ffffffffffffffffffffffffffffffffffffffff8316105b61131f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600160248201527f52000000000000000000000000000000000000000000000000000000000000006044820152606401610b58565b77ffffffffffffffffffffffffffffffffffffffff00000000602083901b166fffffffffffffffffffffffffffffffff811160071b81811c67ffffffffffffffff811160061b90811c63ffffffff811160051b90811c61ffff811160041b90811c60ff8111600390811b91821c600f811160021b90811c918211600190811b92831c979088119617909417909217179091171717608081106113d0576113c6607f826119a2565b83901c91506113e1565b6113db81607f6119a2565b83901b91505b600060406113f0608084611ee4565b901b9050828302607f1c92508260801c80603f1b8217915083811c935050828302607f1c92508260801c80603e1b8217915083811c935050828302607f1c92508260801c80603d1b8217915083811c935050828302607f1c92508260801c80603c1b8217915083811c935050828302607f1c92508260801c80603b1b8217915083811c935050828302607f1c92508260801c80603a1b8217915083811c935050828302607f1c92508260801c8060391b8217915083811c935050828302607f1c92508260801c8060381b8217915083811c935050828302607f1c92508260801c8060371b8217915083811c935050828302607f1c92508260801c8060361b8217915083811c935050828302607f1c92508260801c8060351b8217915083811c935050828302607f1c92508260801c8060341b8217915083811c935050828302607f1c92508260801c8060331b8217915083811c935050828302607f1c92508260801c8060321b8217915050600081693627a301d71055774c856115739190611f04565b9050600060806115936f028f6481ab7f045a5af012a19d003aaa84611ee4565b901d9050600060806115b5846fdb2df09e81959a81455e260799a0632f611fc0565b901d90508060020b8260020b1461160e578873ffffffffffffffffffffffffffffffffffffffff166115e682610aa1565b73ffffffffffffffffffffffffffffffffffffffff1611156116085781611610565b80611610565b815b9998505050505050505050565b600061162a848484610f43565b90506000828061163c5761163c6119b5565b8486091115611010577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811061167157600080fd5b8061167b81611fe8565b95945050505050565b60008160000361169657506000919050565b81600170010000000000000000000000000000000082106116bc5760809190911c9060401b5b6801000000000000000082106116d75760409190911c9060201b5b64010000000082106116ee5760209190911c9060101b5b6201000082106117035760109190911c9060081b5b61010082106117175760089190911c9060041b5b6010821061172a5760049190911c9060021b5b600482106117365760011b5b6001818581611747576117476119b5565b048201901c9050600181858161175f5761175f6119b5565b048201901c90506001818581611777576117776119b5565b048201901c9050600181858161178f5761178f6119b5565b048201901c905060018185816117a7576117a76119b5565b048201901c905060018185816117bf576117bf6119b5565b048201901c905060018185816117d7576117d76119b5565b048201901c905060008185816117ef576117ef6119b5565b0490508082106117ff578061167b565b509392505050565b919050565b8060020b811461181b57600080fd5b50565b6fffffffffffffffffffffffffffffffff8116811461181b57600080fd5b73ffffffffffffffffffffffffffffffffffffffff8116811461181b57600080fd5b6000806000806080858703121561187457600080fd5b843561187f8161180c565b9350602085013561188f8161181e565b9250604085013561189f8161183c565b915060608501356118af8161183c565b939692955090935050565b6000602082840312156118cc57600080fd5b5035919050565b600080604083850312156118e657600080fd5b50508035926020909101359150565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561195c5761195c6118f5565b500290565b80516118078161183c565b60006020828403121561197e57600080fd5b81516112388161183c565b60006020828403121561199b57600080fd5b5051919050565b8181038181111561123b5761123b6118f5565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000826119f3576119f36119b5565b500490565b80516118078161180c565b805161ffff8116811461180757600080fd5b600080600080600080600060e0888a031215611a3057600080fd5b8751611a3b8161183c565b6020890151909750611a4c8161180c565b9550611a5a60408901611a03565b9450611a6860608901611a03565b9350611a7660808901611a03565b925060a088015160ff81168114611a8c57600080fd5b60c08901519092508015158114611aa257600080fd5b8091505092959891949750929550565b805162ffffff8116811461180757600080fd5b80516118078161181e565b6000806000806000806000806000806000806101808d8f031215611af357600080fd5b8c516bffffffffffffffffffffffff81168114611b0f57600080fd5b9b50611b1d60208e01611961565b9a50611b2b60408e01611961565b9950611b3960608e01611961565b9850611b4760808e01611ab2565b9750611b5560a08e016119f8565b9650611b6360c08e016119f8565b9550611b7160e08e01611ac5565b94506101008d015193506101208d01519250611b906101408e01611ac5565b9150611b9f6101608e01611ac5565b90509295989b509295989b509295989b565b600181815b80851115611c0a57817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04821115611bf057611bf06118f5565b80851615611bfd57918102915b93841c9390800290611bb6565b509250929050565b600082611c215750600161123b565b81611c2e5750600061123b565b8160018114611c445760028114611c4e57611c6a565b600191505061123b565b60ff841115611c5f57611c5f6118f5565b50506001821b61123b565b5060208310610133831016604e8410600b8410161715611c8d575081810a61123b565b611c978383611bb1565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04821115611cc957611cc96118f5565b029392505050565b60006110108383611c12565b60ff828116828216039081111561123b5761123b6118f5565b60008160020b8360020b80611d0d57611d0d6119b5565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81147fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80000083141615611d6157611d616118f5565b90059392505050565b60008160020b8360020b627fffff600082136000841383830485118282161615611d9657611d966118f5565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8000006000851286820586128184161615611dd157611dd16118f5565b60008712925085820587128484161615611ded57611ded6118f5565b85850587128184161615611e0357611e036118f5565b5050509290910295945050505050565b60007f80000000000000000000000000000000000000000000000000000000000000008203611e4457611e446118f5565b5060000390565b60008160020b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8000008103611e8057611e806118f5565b60000392915050565b600082611e9857611e986119b5565b500690565b8082018082111561123b5761123b6118f5565b73ffffffffffffffffffffffffffffffffffffffff828116828216039080821115611edd57611edd6118f5565b5092915050565b8181036000831280158383131683831282161715611edd57611edd6118f5565b60007f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600084136000841385830485118282161615611f4557611f456118f5565b7f80000000000000000000000000000000000000000000000000000000000000006000871286820588128184161615611f8057611f806118f5565b60008712925087820587128484161615611f9c57611f9c6118f5565b87850587128184161615611fb257611fb26118f5565b505050929093029392505050565b8082018281126000831280158216821582161715611fe057611fe06118f5565b505092915050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612019576120196118f5565b506001019056fea26469706673582212209ba449b7f3522a9ee538629d10b7742abadebdd4e9796f5819177c3313e776e564736f6c63430008100033

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

0000000000000000000000004f4219c9b851aebb652dd182d944a99b0b68edcf000000000000000000000000ff970a61a04b1ca14834a43f5de4533ebddb5cc8

-----Decoded View---------------
Arg [0] : _sweep_address (address): 0x4F4219c9B851AEbB652DD182D944A99b0b68edcf
Arg [1] : _usdc_address (address): 0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000004f4219c9b851aebb652dd182d944a99b0b68edcf
Arg [1] : 000000000000000000000000ff970a61a04b1ca14834a43f5de4533ebddb5cc8


Deployed ByteCode Sourcemap

890:3821:23:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3755:953;;;;;;:::i;:::-;;:::i;:::-;;;1265:25:30;;;1253:2;1238:18;3755:953:23;;;;;;;;946:18;;;;;;;;;;;;1492:42:30;1480:55;;;1462:74;;1450:2;1435:18;946::23;1301:241:30;1453:848:23;;;:::i;2307:898::-;;;;;;:::i;:::-;;:::i;970:19::-;;;;;;;;;3211:538;;;;;;:::i;:::-;;:::i;:::-;;;2402:1:30;2391:21;;;;2373:40;;2361:2;2346:18;3211:538:23;2231:188:30;1122:152:23;;1231:42;1122:152;;995:121;;1073:42;995:121;;3755:953;3909:19;3940:20;3963:33;3991:4;3963:27;:33::i;:::-;3940:56;-1:-1:-1;4131:17:23;4115:33;;;;4111:591;;4164:17;4184:36;;;;;;:::i;:::-;4164:56;;4260:10;4248:22;;:9;:22;;;:156;;4356:48;4372:8;4382:10;4356:48;;4394:9;4356:15;:48::i;:::-;4248:156;;;4289:48;4305:9;4316:10;4289:48;;4328:8;4289:15;:48::i;:::-;4234:170;;4150:265;4111:591;;;4435:17;4455:52;;;;;4499:7;4455:15;:52::i;:::-;4435:72;;4547:10;4535:22;;:9;:22;;;:156;;4643:48;4659:8;4669:10;4643:48;;4681:9;4643:15;:48::i;:::-;4535:156;;;4576:48;4592:9;4603:10;4576:48;;4615:8;4576:15;:48::i;:::-;4521:170;;4421:281;4111:591;3930:778;3755:953;;;;;;:::o;1453:848::-;1600:5;;1518:14;1616:4;;1568:60;;;;;:23;1600:5;;;1568:60;;;3643:34:30;1616:4:23;;3693:18:30;;;3686:43;1623:4:23;3745:18:30;;;3738:49;1518:14:23;;;1073:42;;1568:23;;3555:18:30;;1568:60:23;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;1723:5;;:30;;;;;:5;1480:55:30;;;1723:30:23;;;1462:74:30;1544:84:23;;-1:-1:-1;1544:84:23;;1638:19;;1723:5;;:15;;1435:18:30;;1723:30:23;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;1763:19;1785:4;;:29;;;;;:4;1480:55:30;;;1785:29:23;;;1462:74:30;1700:53:23;;-1:-1:-1;1763:19:23;;1785:4;;:14;;1435:18:30;;1785:29:23;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;1763:51;;1824:20;1847:5;;;;;;;;;;;:18;;;:20;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;1824:43;-1:-1:-1;1877:16:23;1926:11;1896:27;1911:12;1824:43;1896:27;:::i;:::-;:41;;;;:::i;:::-;:47;;1940:3;1896:47;:::i;:::-;1877:66;;1953:12;1968:15;:8;:13;:15::i;:::-;1953:30;;1994:20;2025:12;2018:4;:19;2017:69;;2066:19;2081:4;2066:12;:19;:::i;:::-;2017:69;;;2042:19;2049:12;2042:4;:19;:::i;:::-;1994:92;-1:-1:-1;2132:4:23;2111:18;1994:92;2126:3;2111:18;:::i;:::-;:25;;;;:::i;:::-;2096:40;;2150:17;2181:4;:10;;;:12;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;;2272:5:23;;;2288:4;2147:46;;-1:-1:-1;2213:81:23;;-1:-1:-1;2147:46:23;;2249:12;;-1:-1:-1;2272:5:23;;;;;-1:-1:-1;2288:4:23;;-1:-1:-1;2213:14:23;:81::i;:::-;2204:90;;1534:767;;;;;;;;;1453:848;:::o;2307:898::-;2459:5;;2377:14;2475:4;;2427:60;;;;;:23;2459:5;;;2427:60;;;3643:34:30;2475:4:23;;3693:18:30;;;3686:43;2482:4:23;3745:18:30;;;3738:49;2377:14:23;;;1073:42;;2427:23;;3555:18:30;;2427:60:23;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;2403:84;;2497:19;2534:13;2497:51;;2561:17;2592:4;:10;;;:12;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;;2664:45:23;;;;;;;;1265:25:30;;;2558:46:23;;-1:-1:-1;2621:15:23;;-1:-1:-1;2621:15:23;;1231:42;;-1:-1:-1;2664:36:23;;-1:-1:-1;1238:18:30;;;-1:-1:-1;2664:45:23;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;2614:95;;;;;;;;;;;;;;2720:16;2739:42;2756:5;;;;;;;;;;;:18;;;:20;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;2778:2;2739:16;:42::i;:::-;2720:61;;2792:26;2928:4;2821:104;2866:9;2851:26;;2894:11;2879:28;;2909:9;2920:4;2821:29;:104::i;:::-;:111;;;;:::i;:::-;2792:140;;2942:25;3076:4;2970:103;3015:9;3000:26;;3043:10;3028:27;;3057:9;3068:4;2970:29;:103::i;:::-;:110;;;;:::i;:::-;2942:138;;3121:18;3101:17;:38;3100:98;;3197:1;3100:98;;;3156:38;3176:18;3156:17;:38;:::i;:::-;3091:107;2307:898;-1:-1:-1;;;;;;;;;;2307:898:23:o;3211:538::-;3317:11;3364:2;3317:11;3392:37;3415:13;3419:9;3415:2;:13;:::i;:::-;3392:22;:37::i;:::-;3376:53;;3439:13;3455:30;3478:6;3455:22;:30::i;:::-;3439:46;;3495:12;3510:33;3528:6;3536;3510:17;:33::i;:::-;3495:48;-1:-1:-1;3561:127:23;3647:28;3673:2;316::1;3647:28:23;:::i;:::-;3617:59;;:25;3636:5;3617:18;:25::i;:::-;:59;;;;3610:67;;3561:27;:127::i;:::-;3553:135;-1:-1:-1;3731:11:23;3708:19;3731:11;3553:135;3708:19;:::i;:::-;3707:35;;;;:::i;:::-;3699:43;3211:538;-1:-1:-1;;;;;;;3211:538:23:o;1354:2587:28:-;1417:20;1449:15;1474:1;1467:4;:8;;;:57;;1518:4;1511:12;;1467:57;;;1494:4;1487:12;;1486:13;;;:::i;:::-;1449:75;-1:-1:-1;636:9:28;476:7;636:9;:::i;:::-;1561:16;;1549:7;1542:35;;1534:49;;;;;;;11220:2:30;1534:49:28;;;11202:21:30;11259:1;11239:18;;;11232:29;11297:3;11277:18;;;11270:31;11318:18;;1534:49:28;;;;;;;;;1594:13;1610:7;1620:3;1610:13;1627:1;1610:18;:93;;1668:35;1610:93;;;1631:34;1610:93;1594:109;;;-1:-1:-1;1727:3:28;1717:13;;:18;1713:83;;1793:3;1746:42;:5;1754:34;1746:42;:::i;:::-;1745:51;;1737:59;;1713:83;1820:3;1810:13;;:18;1806:83;;1886:3;1839:42;:5;1847:34;1839:42;:::i;:::-;1838:51;;1830:59;;1806:83;1913:3;1903:13;;:18;1899:83;;1979:3;1932:42;:5;1940:34;1932:42;:::i;:::-;1931:51;;1923:59;;1899:83;2006:4;1996:14;;:19;1992:84;;2073:3;2026:42;:5;2034:34;2026:42;:::i;:::-;2025:51;;2017:59;;1992:84;2100:4;2090:14;;:19;2086:84;;2167:3;2120:42;:5;2128:34;2120:42;:::i;:::-;2119:51;;2111:59;;2086:84;2194:4;2184:14;;:19;2180:84;;2261:3;2214:42;:5;2222:34;2214:42;:::i;:::-;2213:51;;2205:59;;2180:84;2288:4;2278:14;;:19;2274:84;;2355:3;2308:42;:5;2316:34;2308:42;:::i;:::-;2307:51;;2299:59;;2274:84;2382:5;2372:15;;:20;2368:85;;2450:3;2403:42;:5;2411:34;2403:42;:::i;:::-;2402:51;;2394:59;;2368:85;2477:5;2467:15;;:20;2463:85;;2545:3;2498:42;:5;2506:34;2498:42;:::i;:::-;2497:51;;2489:59;;2463:85;2572:5;2562:15;;:20;2558:85;;2640:3;2593:42;:5;2601:34;2593:42;:::i;:::-;2592:51;;2584:59;;2558:85;2667:5;2657:15;;:20;2653:85;;2735:3;2688:42;:5;2696:34;2688:42;:::i;:::-;2687:51;;2679:59;;2653:85;2762:6;2752:16;;:21;2748:86;;2831:3;2784:42;:5;2792:34;2784:42;:::i;:::-;2783:51;;2775:59;;2748:86;2858:6;2848:16;;:21;2844:86;;2927:3;2880:42;:5;2888:34;2880:42;:::i;:::-;2879:51;;2871:59;;2844:86;2954:6;2944:16;;:21;2940:86;;3023:3;2976:42;:5;2984:34;2976:42;:::i;:::-;2975:51;;2967:59;;2940:86;3050:6;3040:16;;:21;3036:86;;3119:3;3072:42;:5;3080:34;3072:42;:::i;:::-;3071:51;;3063:59;;3036:86;3146:7;3136:17;;:22;3132:86;;3215:3;3169:41;:5;3177:33;3169:41;:::i;:::-;3168:50;;3160:58;;3132:86;3242:7;3232:17;;:22;3228:85;;3310:3;3265:40;:5;3273:32;3265:40;:::i;:::-;3264:49;;3256:57;;3228:85;3337:7;3327:17;;:22;3323:83;;3403:3;3360:38;:5;3368:30;3360:38;:::i;:::-;3359:47;;3351:55;;3323:83;3430:7;3420:17;;:22;3416:78;;3491:3;3453:33;:5;3461:25;3453:33;:::i;:::-;3452:42;;3444:50;;3416:78;3516:1;3509:4;:8;;;3505:47;;;3527:25;3547:5;3527:17;:25;:::i;:::-;3519:33;;3505:47;3902:17;3911:7;3902:5;:17;:::i;:::-;:22;:30;;3931:1;3902:30;;;3927:1;3902:30;3885:48;;;;3895:2;3886:11;;;3885:48;:::i;:::-;3862:72;1354:2587;-1:-1:-1;;;;1354:2587:28:o;960:3920:2:-;1072:14;;;1564:6;1561:1;1558;1551:20;1600:1;1597;1593:9;1584:18;;1651:5;1647:2;1644:13;1636:5;1632:2;1628:14;1624:34;1615:43;;;1741:5;1750:1;1741:10;1737:176;;1789:1;1775:11;:15;1767:24;;;;;;1850:11;1842:5;:19;;;;;:::i;:::-;;1833:28;;1889:13;;;;1737:176;2242:17;2365:11;2362:1;2359;2352:25;2896:12;;2911:1;2896:16;;;2881:32;;3019:25;;;;;2514:21;;;3123:19;;;2471:20;;;;2460:32;;;2863:15;3285;;;3281:29;;;;3277:37;;;3403:15;;;;3394:24;;;;3755:1;:15;;3774:1;3754:21;;;4007;;;4003:25;;3992:36;4076:21;;;4072:25;;4061:36;4146:21;;;4142:25;;4131:36;4216:21;;;4212:25;;4201:36;4286:21;;;4282:25;;4271:36;4357:21;;;4353:25;;;4342:36;4821:15;;-1:-1:-1;;960:3920:2;;;;;;:::o;5338:200:26:-;5386:9;;5429:1;5420:5;:1;5424;5420:5;:::i;:::-;5419:11;;;;:::i;:::-;5407:23;;5444:1;5440:5;;5455:77;5466:1;5462;:5;5455:77;;;5487:1;-1:-1:-1;5487:1:26;5520;5487;5507:5;5487:1;5507;:5;:::i;:::-;:9;;;;:::i;:::-;5506:15;;;;:::i;:::-;5502:19;;5455:77;;;5397:141;5338:200;;;:::o;7429:779:27:-;7594:15;7641:13;7625:29;;:13;:29;;;7621:98;;;7690:13;;7705;7621:98;7751:45;316:2:1;7751:45:27;;;;7730:18;7827:29;7843:13;7827;:29;:::i;:::-;7806:50;;;;7891:1;7875:13;:17;;;7867:26;;;;;;7923:7;:278;;8188:13;8131:70;;:54;8147:10;8159;8171:13;8131:54;;:15;:54::i;:::-;:70;;;;:::i;7923:278::-;7949:163;7995:64;8021:10;8033;8045:13;7995:64;;:25;:64::i;:::-;8081:13;7949:163;;613:9:29;;;627;;624:16;;609:32;;492:165;2018:174:0;2071:6;2119:18;2114:1;:23;;2105:33;;;;;;-1:-1:-1;2175:2:0;2170:7;;2018:174::o;7264:259::-;7321:6;7364:1;:6;;7369:1;7364:6;7355:16;;;;;;7380:13;7417:1;7396:22;;7411:2;7405:1;7397:10;;:16;;7396:22;;;;;:::i;:::-;;;-1:-1:-1;824:35:0;7436:19;;;;;:42;;-1:-1:-1;982:34:0;7459:19;;;7436:42;7427:52;;;;;;7503:6;-1:-1:-1;7264:259:0;;;;;:::o;14238:170::-;14286:6;14334:1;14329;:6;;;;14320:16;;;;;;14360:34;14391:2;14384:1;14376:10;;14367:26;;14360:5;:34::i;4360:4281:28:-;4433:10;816;4562:30;;;;;;;:63;;-1:-1:-1;996:49:28;4596:29;;;;4562:63;4554:77;;;;;;;12009:2:30;4554:77:28;;;11991:21:30;12048:1;12028:18;;;12021:29;12086:3;12066:18;;;12059:31;12107:18;;4554:77:28;11807:324:30;4554:77:28;4657:27;4682:2;4657:27;;;;4793:34;4787:41;;4784:1;4780:49;4877:9;;;4950:18;4944:25;;4941:1;4937:33;5018:9;;;5091:10;5085:17;;5082:1;5078:25;5151:9;;;5224:6;5218:13;;5215:1;5211:21;5280:9;;;5353:4;5347:11;;5344:1;5340:19;;;5407:9;;;5480:3;5474:10;;5471:1;5467:18;5533:9;;;5600:10;;;5597:1;5593:18;;;5659:9;;;;5719:10;;;4990;;5123;;;5252;;;5379;5505;;;5631;5749;5790:3;5783:10;;5779:79;;5809:9;5815:3;5809;:9;:::i;:::-;5799:5;:20;;5795:24;;5779:79;;;5848:9;5854:3;5848;:9;:::i;:::-;5838:5;:20;;5834:24;;5779:79;5869:12;5907:2;5885:17;5899:3;5892;5885:17;:::i;:::-;5884:25;;5869:40;;5964:1;5961;5957:9;5952:3;5948:19;5943:24;;5998:1;5993:3;5989:11;6040:1;6036:2;6032:10;6025:5;6022:21;6013:30;;6068:1;6065;6061:9;6056:14;;;6133:1;6130;6126:9;6121:3;6117:19;6112:24;;6167:1;6162:3;6158:11;6209:1;6205:2;6201:10;6194:5;6191:21;6182:30;;6237:1;6234;6230:9;6225:14;;;6302:1;6299;6295:9;6290:3;6286:19;6281:24;;6336:1;6331:3;6327:11;6378:1;6374:2;6370:10;6363:5;6360:21;6351:30;;6406:1;6403;6399:9;6394:14;;;6471:1;6468;6464:9;6459:3;6455:19;6450:24;;6505:1;6500:3;6496:11;6547:1;6543:2;6539:10;6532:5;6529:21;6520:30;;6575:1;6572;6568:9;6563:14;;;6640:1;6637;6633:9;6628:3;6624:19;6619:24;;6674:1;6669:3;6665:11;6716:1;6712:2;6708:10;6701:5;6698:21;6689:30;;6744:1;6741;6737:9;6732:14;;;6809:1;6806;6802:9;6797:3;6793:19;6788:24;;6843:1;6838:3;6834:11;6885:1;6881:2;6877:10;6870:5;6867:21;6858:30;;6913:1;6910;6906:9;6901:14;;;6978:1;6975;6971:9;6966:3;6962:19;6957:24;;7012:1;7007:3;7003:11;7054:1;7050:2;7046:10;7039:5;7036:21;7027:30;;7082:1;7079;7075:9;7070:14;;;7147:1;7144;7140:9;7135:3;7131:19;7126:24;;7181:1;7176:3;7172:11;7223:1;7219:2;7215:10;7208:5;7205:21;7196:30;;7251:1;7248;7244:9;7239:14;;;7316:1;7313;7309:9;7304:3;7300:19;7295:24;;7350:1;7345:3;7341:11;7392:1;7388:2;7384:10;7377:5;7374:21;7365:30;;7420:1;7417;7413:9;7408:14;;;7485:1;7482;7478:9;7473:3;7469:19;7464:24;;7519:1;7514:3;7510:11;7561:1;7557:2;7553:10;7546:5;7543:21;7534:30;;7589:1;7586;7582:9;7577:14;;;7654:1;7651;7647:9;7642:3;7638:19;7633:24;;7688:1;7683:3;7679:11;7730:1;7726:2;7722:10;7715:5;7712:21;7703:30;;7758:1;7755;7751:9;7746:14;;;7823:1;7820;7816:9;7811:3;7807:19;7802:24;;7857:1;7852:3;7848:11;7899:1;7895:2;7891:10;7884:5;7881:21;7872:30;;7927:1;7924;7920:9;7915:14;;;7992:1;7989;7985:9;7980:3;7976:19;7971:24;;8026:1;8021:3;8017:11;8068:1;8064:2;8060:10;8053:5;8050:21;8041:30;;8096:1;8093;8089:9;8084:14;;;8161:1;8158;8154:9;8149:3;8145:19;8140:24;;8195:1;8190:3;8186:11;8237:1;8233:2;8229:10;8222:5;8219:21;8210:30;;;8260:20;8283:5;8291:24;8283:32;;;;:::i;:::-;8260:55;-1:-1:-1;8344:13:28;8425:3;8367:53;8383:37;8260:55;8367:53;:::i;:::-;8366:62;;;-1:-1:-1;8439:12:28;8521:3;8461:55;:13;8477:39;8461:55;:::i;:::-;8460:64;;8439:86;;8554:6;8543:17;;:7;:17;;;:91;;8603:12;8573:42;;:26;8592:6;8573:18;:26::i;:::-;:42;;;;:61;;8627:7;8543:91;;8573:61;8618:6;8543:91;;;8563:7;8543:91;8536:98;4360:4281;-1:-1:-1;;;;;;;;;4360:4281:28:o;5162:315:2:-;5284:14;5319:25;5326:1;5329;5332:11;5319:6;:25::i;:::-;5310:34;;5386:1;5371:11;5358:25;;;;;:::i;:::-;5368:1;5365;5358:25;:29;5354:117;;;5420:17;5411:6;:26;5403:35;;;;;;5452:8;;;;:::i;:::-;;5162:315;-1:-1:-1;;;;;5162:315:2:o;25393:905:0:-;25442:7;25481:1;25486;25481:6;25477:809;;-1:-1:-1;25496:1:0;;25393:905;-1:-1:-1;25393:905:0:o;25477:809::-;25535:1;25559;25581:35;25575:41;;25571:72;;25627:3;25620:10;;;;;25638:2;25632:8;25571:72;25663:19;25657:2;:25;25653:55;;25693:2;25686:9;;;;;25703:2;25697:8;25653:55;25728:11;25722:2;:17;25718:47;;25750:2;25743:9;;;;;25760:2;25754:8;25718:47;25785:7;25779:2;:13;25775:42;;25803:2;25796:9;;;;;25813:1;25807:7;25775:42;25837:5;25831:2;:11;25827:39;;25853:1;25846:8;;;;;25862:1;25856:7;25827:39;25886:4;25880:2;:10;25876:38;;25901:1;25894:8;;;;;25910:1;25904:7;25876:38;25934:3;25928:2;:9;25924:27;;25947:1;25941:7;25924:27;25980:1;25974;25970;:5;;;;;:::i;:::-;;25966:1;:9;25965:16;;25961:20;;26011:1;26005;26001;:5;;;;;:::i;:::-;;25997:1;:9;25996:16;;25992:20;;26042:1;26036;26032;:5;;;;;:::i;:::-;;26028:1;:9;26027:16;;26023:20;;26073:1;26067;26063;:5;;;;;:::i;:::-;;26059:1;:9;26058:16;;26054:20;;26104:1;26098;26094;:5;;;;;:::i;:::-;;26090:1;:9;26089:16;;26085:20;;26135:1;26129;26125;:5;;;;;:::i;:::-;;26121:1;:9;26120:16;;26116:20;;26166:1;26160;26156;:5;;;;;:::i;:::-;;26152:1;:9;26151:16;;26147:20;;26215:10;26232:1;26228;:5;;;;;:::i;:::-;;26215:18;;26264:2;26260:1;:6;:15;;26273:2;26260:15;;;-1:-1:-1;26269:1:0;26244:32;-1:-1:-1;;;25393:905:0:o;25477:809::-;25393:905;;;:::o;14:118:30:-;101:5;98:1;87:20;80:5;77:31;67:59;;122:1;119;112:12;67:59;14:118;:::o;137:146::-;223:34;216:5;212:46;205:5;202:57;192:85;;273:1;270;263:12;288:154;374:42;367:5;363:54;356:5;353:65;343:93;;432:1;429;422:12;447:667;531:6;539;547;555;608:3;596:9;587:7;583:23;579:33;576:53;;;625:1;622;615:12;576:53;664:9;651:23;683:29;706:5;683:29;:::i;:::-;731:5;-1:-1:-1;788:2:30;773:18;;760:32;801:33;760:32;801:33;:::i;:::-;853:7;-1:-1:-1;912:2:30;897:18;;884:32;925:33;884:32;925:33;:::i;:::-;977:7;-1:-1:-1;1036:2:30;1021:18;;1008:32;1049:33;1008:32;1049:33;:::i;:::-;447:667;;;;-1:-1:-1;447:667:30;;-1:-1:-1;;447:667:30:o;1547:180::-;1606:6;1659:2;1647:9;1638:7;1634:23;1630:32;1627:52;;;1675:1;1672;1665:12;1627:52;-1:-1:-1;1698:23:30;;1547:180;-1:-1:-1;1547:180:30:o;1978:248::-;2046:6;2054;2107:2;2095:9;2086:7;2082:23;2078:32;2075:52;;;2123:1;2120;2113:12;2075:52;-1:-1:-1;;2146:23:30;;;2216:2;2201:18;;;2188:32;;-1:-1:-1;1978:248:30:o;2948:184::-;3000:77;2997:1;2990:88;3097:4;3094:1;3087:15;3121:4;3118:1;3111:15;3137:228;3177:7;3303:1;3235:66;3231:74;3228:1;3225:81;3220:1;3213:9;3206:17;3202:105;3199:131;;;3310:18;;:::i;:::-;-1:-1:-1;3350:9:30;;3137:228::o;3798:138::-;3877:13;;3899:31;3877:13;3899:31;:::i;3941:251::-;4011:6;4064:2;4052:9;4043:7;4039:23;4035:32;4032:52;;;4080:1;4077;4070:12;4032:52;4112:9;4106:16;4131:31;4156:5;4131:31;:::i;4428:184::-;4498:6;4551:2;4539:9;4530:7;4526:23;4522:32;4519:52;;;4567:1;4564;4557:12;4519:52;-1:-1:-1;4590:16:30;;4428:184;-1:-1:-1;4428:184:30:o;4617:128::-;4684:9;;;4705:11;;;4702:37;;;4719:18;;:::i;4750:184::-;4802:77;4799:1;4792:88;4899:4;4896:1;4889:15;4923:4;4920:1;4913:15;4939:120;4979:1;5005;4995:35;;5010:18;;:::i;:::-;-1:-1:-1;5044:9:30;;4939:120::o;5064:134::-;5141:13;;5163:29;5141:13;5163:29;:::i;5203:163::-;5281:13;;5334:6;5323:18;;5313:29;;5303:57;;5356:1;5353;5346:12;5371:954;5485:6;5493;5501;5509;5517;5525;5533;5586:3;5574:9;5565:7;5561:23;5557:33;5554:53;;;5603:1;5600;5593:12;5554:53;5635:9;5629:16;5654:31;5679:5;5654:31;:::i;:::-;5754:2;5739:18;;5733:25;5704:5;;-1:-1:-1;5767:31:30;5733:25;5767:31;:::i;:::-;5817:7;-1:-1:-1;5843:48:30;5887:2;5872:18;;5843:48;:::i;:::-;5833:58;;5910:48;5954:2;5943:9;5939:18;5910:48;:::i;:::-;5900:58;;5977:49;6021:3;6010:9;6006:19;5977:49;:::i;:::-;5967:59;;6071:3;6060:9;6056:19;6050:26;6120:4;6111:7;6107:18;6098:7;6095:31;6085:59;;6140:1;6137;6130:12;6085:59;6215:3;6200:19;;6194:26;6163:7;;-1:-1:-1;6258:15:30;;6251:23;6239:36;;6229:64;;6289:1;6286;6279:12;6229:64;6312:7;6302:17;;;5371:954;;;;;;;;;;:::o;6330:165::-;6408:13;;6461:8;6450:20;;6440:31;;6430:59;;6485:1;6482;6475:12;6500:138;6579:13;;6601:31;6579:13;6601:31;:::i;6643:1186::-;6806:6;6814;6822;6830;6838;6846;6854;6862;6870;6878;6886:7;6895;6949:3;6937:9;6928:7;6924:23;6920:33;6917:53;;;6966:1;6963;6956:12;6917:53;6998:9;6992:16;7048:26;7041:5;7037:38;7030:5;7027:49;7017:77;;7090:1;7087;7080:12;7017:77;7113:5;-1:-1:-1;7137:49:30;7182:2;7167:18;;7137:49;:::i;:::-;7127:59;;7205:49;7250:2;7239:9;7235:18;7205:49;:::i;:::-;7195:59;;7273:49;7318:2;7307:9;7303:18;7273:49;:::i;:::-;7263:59;;7341:49;7385:3;7374:9;7370:19;7341:49;:::i;:::-;7331:59;;7409:48;7452:3;7441:9;7437:19;7409:48;:::i;:::-;7399:58;;7476:48;7519:3;7508:9;7504:19;7476:48;:::i;:::-;7466:58;;7543:50;7588:3;7577:9;7573:19;7543:50;:::i;:::-;7533:60;;7633:3;7622:9;7618:19;7612:26;7602:36;;7678:3;7667:9;7663:19;7657:26;7647:36;;7703:50;7748:3;7737:9;7733:19;7703:50;:::i;:::-;7692:61;;7773:50;7818:3;7807:9;7803:19;7773:50;:::i;:::-;7762:61;;6643:1186;;;;;;;;;;;;;;:::o;7834:482::-;7923:1;7966:5;7923:1;7980:330;8001:7;7991:8;7988:21;7980:330;;;8120:4;8052:66;8048:77;8042:4;8039:87;8036:113;;;8129:18;;:::i;:::-;8179:7;8169:8;8165:22;8162:55;;;8199:16;;;;8162:55;8278:22;;;;8238:15;;;;7980:330;;;7984:3;7834:482;;;;;:::o;8321:866::-;8370:5;8400:8;8390:80;;-1:-1:-1;8441:1:30;8455:5;;8390:80;8489:4;8479:76;;-1:-1:-1;8526:1:30;8540:5;;8479:76;8571:4;8589:1;8584:59;;;;8657:1;8652:130;;;;8564:218;;8584:59;8614:1;8605:10;;8628:5;;;8652:130;8689:3;8679:8;8676:17;8673:43;;;8696:18;;:::i;:::-;-1:-1:-1;;8752:1:30;8738:16;;8767:5;;8564:218;;8866:2;8856:8;8853:16;8847:3;8841:4;8838:13;8834:36;8828:2;8818:8;8815:16;8810:2;8804:4;8801:12;8797:35;8794:77;8791:159;;;-1:-1:-1;8903:19:30;;;8935:5;;8791:159;8982:34;9007:8;9001:4;8982:34;:::i;:::-;9112:6;9044:66;9040:79;9031:7;9028:92;9025:118;;;9123:18;;:::i;:::-;9161:20;;8321:866;-1:-1:-1;;;8321:866:30:o;9192:131::-;9252:5;9281:36;9308:8;9302:4;9281:36;:::i;9328:151::-;9418:4;9411:12;;;9397;;;9393:31;;9436:14;;9433:40;;;9453:18;;:::i;9484:389::-;9522:1;9563;9560;9549:16;9599:1;9596;9585:16;9620:3;9610:37;;9627:18;;:::i;:::-;9748:66;9743:3;9740:75;9671:66;9666:3;9663:75;9659:157;9656:183;;;9819:18;;:::i;:::-;9853:14;;;9484:389;-1:-1:-1;;;9484:389:30:o;9878:696::-;9916:7;9963:1;9960;9949:16;9999:1;9996;9985:16;10020:8;10056:1;10051:3;10047:11;10086:1;10081:3;10077:11;10133:3;10129:2;10125:12;10120:3;10117:21;10112:2;10108;10104:11;10100:39;10097:65;;;10142:18;;:::i;:::-;10181:66;10275:1;10270:3;10266:11;10324:3;10320:2;10315:13;10310:3;10306:23;10301:2;10297;10293:11;10289:41;10286:67;;;10333:18;;:::i;:::-;10381:1;10376:3;10372:11;10362:21;;10430:3;10426:2;10421:13;10416:3;10412:23;10407:2;10403;10399:11;10395:41;10392:67;;;10439:18;;:::i;:::-;10506:3;10502:2;10497:13;10492:3;10488:23;10483:2;10479;10475:11;10471:41;10468:67;;;10515:18;;:::i;:::-;-1:-1:-1;;;10555:13:30;;;;;9878:696;-1:-1:-1;;;;;9878:696:30:o;10579:191::-;10614:3;10645:66;10638:5;10635:77;10632:103;;10715:18;;:::i;:::-;-1:-1:-1;10755:1:30;10751:13;;10579:191::o;10775:238::-;10809:3;10856:5;10853:1;10842:20;10886:66;10877:7;10874:79;10871:105;;10956:18;;:::i;:::-;10996:1;10992:15;;10775:238;-1:-1:-1;;10775:238:30:o;11347:112::-;11379:1;11405;11395:35;;11410:18;;:::i;:::-;-1:-1:-1;11444:9:30;;11347:112::o;11464:125::-;11529:9;;;11550:10;;;11547:36;;;11563:18;;:::i;11594:208::-;11663:42;11738:10;;;11726;;;11722:27;;11761:12;;;11758:38;;;11776:18;;:::i;:::-;11758:38;11594:208;;;;:::o;12136:200::-;12202:9;;;12175:4;12230:9;;12258:10;;12270:12;;;12254:29;12293:12;;;12285:21;;12251:56;12248:82;;;12310:18;;:::i;12341:655::-;12380:7;12412:66;12504:1;12501;12497:9;12532:1;12529;12525:9;12577:1;12573:2;12569:10;12566:1;12563:17;12558:2;12554;12550:11;12546:35;12543:61;;;12584:18;;:::i;:::-;12623:66;12715:1;12712;12708:9;12762:1;12758:2;12753:11;12750:1;12746:19;12741:2;12737;12733:11;12729:37;12726:63;;;12769:18;;:::i;:::-;12815:1;12812;12808:9;12798:19;;12862:1;12858:2;12853:11;12850:1;12846:19;12841:2;12837;12833:11;12829:37;12826:63;;;12869:18;;:::i;:::-;12934:1;12930:2;12925:11;12922:1;12918:19;12913:2;12909;12905:11;12901:37;12898:63;;;12941:18;;:::i;:::-;-1:-1:-1;;;12981:9:30;;;;;12341:655;-1:-1:-1;;;12341:655:30:o;13001:216::-;13065:9;;;13093:11;;;13040:3;13123:9;;13151:10;;13147:19;;13176:10;;13168:19;;13144:44;13141:70;;;13191:18;;:::i;:::-;13141:70;;13001:216;;;;:::o;13222:195::-;13261:3;13292:66;13285:5;13282:77;13279:103;;13362:18;;:::i;:::-;-1:-1:-1;13409:1:30;13398:13;;13222:195::o

Metadata Hash

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