ETH Price: $3,624.27 (-2.32%)

Contract

0x1393ad734EA3c52865b4B541cf049dafd25c23a5
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Buyn Burn211674642024-11-11 22:35:5921 days ago1731364559IN
0x1393ad73...fd25c23a5
0 ETH0.006040340.34479263
Buyn Burn211674442024-11-11 22:31:5921 days ago1731364319IN
0x1393ad73...fd25c23a5
0 ETH0.0068192643.10100273
Buyn Burn211674302024-11-11 22:29:1121 days ago1731364151IN
0x1393ad73...fd25c23a5
0 ETH0.0076872248.60904689
Set Global Weth ...211674142024-11-11 22:25:5921 days ago1731363959IN
0x1393ad73...fd25c23a5
0 ETH0.0016910358.906684
Buyn Burn211674022024-11-11 22:23:3521 days ago1731363815IN
0x1393ad73...fd25c23a5
0 ETH0.0088703456.06548991
Buyn Burn211673972024-11-11 22:22:3521 days ago1731363755IN
0x1393ad73...fd25c23a5
0 ETH0.008339152.71175559
Set Global Weth ...211673932024-11-11 22:21:4721 days ago1731363707IN
0x1393ad73...fd25c23a5
0 ETH0.0016128856.18423409
Buyn Burn211673212024-11-11 22:07:1121 days ago1731362831IN
0x1393ad73...fd25c23a5
0 ETH0.0016758347.41371747
Buyn Burn211673202024-11-11 22:06:5921 days ago1731362819IN
0x1393ad73...fd25c23a5
0 ETH0.007434549.3151256
Buyn Burn211673202024-11-11 22:06:5921 days ago1731362819IN
0x1393ad73...fd25c23a5
0 ETH0.0078017549.3151256
Buyn Burn211673172024-11-11 22:06:2321 days ago1731362783IN
0x1393ad73...fd25c23a5
0 ETH0.0077145648.7763496
Set Global Weth ...211673112024-11-11 22:05:1121 days ago1731362711IN
0x1393ad73...fd25c23a5
0 ETH0.0015362653.51519166
Buyn Burn211673062024-11-11 22:04:1121 days ago1731362651IN
0x1393ad73...fd25c23a5
0 ETH0.0067839444.99146645
Buyn Burn211673032024-11-11 22:03:3521 days ago1731362615IN
0x1393ad73...fd25c23a5
0 ETH0.0073812447.39408078
Buyn Burn211672972024-11-11 22:02:2321 days ago1731362543IN
0x1393ad73...fd25c23a5
0 ETH0.0071141344.91301217
Buyn Burn211672972024-11-11 22:02:2321 days ago1731362543IN
0x1393ad73...fd25c23a5
0 ETH0.0069824944.91301217
Set Global Weth ...211672952024-11-11 22:01:5921 days ago1731362519IN
0x1393ad73...fd25c23a5
0 ETH0.0014507450.53637413
Buyn Burn211672572024-11-11 21:54:2321 days ago1731362063IN
0x1393ad73...fd25c23a5
0 ETH0.0063993639.36760826
Set Global Weth ...211672512024-11-11 21:53:1121 days ago1731361991IN
0x1393ad73...fd25c23a5
0 ETH0.0013634747.49615601
Buyn Burn211672252024-11-11 21:47:5921 days ago1731361679IN
0x1393ad73...fd25c23a5
0 ETH0.007768847.78042173
Set Global Weth ...211672212024-11-11 21:47:1121 days ago1731361631IN
0x1393ad73...fd25c23a5
0 ETH0.0015528554.09311918
Buyn Burn211672152024-11-11 21:45:5921 days ago1731361559IN
0x1393ad73...fd25c23a5
0 ETH0.0091238547.34035025
Set Global Weth ...211672122024-11-11 21:45:2321 days ago1731361523IN
0x1393ad73...fd25c23a5
0 ETH0.0014452150.34351684
Buyn Burn211671772024-11-11 21:38:2321 days ago1731361103IN
0x1393ad73...fd25c23a5
0 ETH0.0072362444.50117479
Set Global Weth ...211671762024-11-11 21:38:1121 days ago1731361091IN
0x1393ad73...fd25c23a5
0 ETH0.0013753247.90896281
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
211674642024-11-11 22:35:5921 days ago1731364559
0x1393ad73...fd25c23a5
0.00004374 ETH
211674642024-11-11 22:35:5921 days ago1731364559
0x1393ad73...fd25c23a5
0.00004374 ETH
211674442024-11-11 22:31:5921 days ago1731364319
0x1393ad73...fd25c23a5
0.0033 ETH
211674442024-11-11 22:31:5921 days ago1731364319
0x1393ad73...fd25c23a5
0.0033 ETH
211674302024-11-11 22:29:1121 days ago1731364151
0x1393ad73...fd25c23a5
0.0033 ETH
211674302024-11-11 22:29:1121 days ago1731364151
0x1393ad73...fd25c23a5
0.0033 ETH
211674022024-11-11 22:23:3521 days ago1731363815
0x1393ad73...fd25c23a5
0.0033 ETH
211674022024-11-11 22:23:3521 days ago1731363815
0x1393ad73...fd25c23a5
0.0033 ETH
211673972024-11-11 22:22:3521 days ago1731363755
0x1393ad73...fd25c23a5
0.0033 ETH
211673972024-11-11 22:22:3521 days ago1731363755
0x1393ad73...fd25c23a5
0.0033 ETH
211673202024-11-11 22:06:5921 days ago1731362819
0x1393ad73...fd25c23a5
0.00002186 ETH
211673202024-11-11 22:06:5921 days ago1731362819
0x1393ad73...fd25c23a5
0.00002186 ETH
211673202024-11-11 22:06:5921 days ago1731362819
0x1393ad73...fd25c23a5
0.0033 ETH
211673202024-11-11 22:06:5921 days ago1731362819
0x1393ad73...fd25c23a5
0.0033 ETH
211673172024-11-11 22:06:2321 days ago1731362783
0x1393ad73...fd25c23a5
0.0033 ETH
211673172024-11-11 22:06:2321 days ago1731362783
0x1393ad73...fd25c23a5
0.0033 ETH
211673062024-11-11 22:04:1121 days ago1731362651
0x1393ad73...fd25c23a5
0.00001631 ETH
211673062024-11-11 22:04:1121 days ago1731362651
0x1393ad73...fd25c23a5
0.00001631 ETH
211673032024-11-11 22:03:3521 days ago1731362615
0x1393ad73...fd25c23a5
0.00001631 ETH
211673032024-11-11 22:03:3521 days ago1731362615
0x1393ad73...fd25c23a5
0.00001631 ETH
211672972024-11-11 22:02:2321 days ago1731362543
0x1393ad73...fd25c23a5
0.0033 ETH
211672972024-11-11 22:02:2321 days ago1731362543
0x1393ad73...fd25c23a5
0.0033 ETH
211672972024-11-11 22:02:2321 days ago1731362543
0x1393ad73...fd25c23a5
0.0033 ETH
211672972024-11-11 22:02:2321 days ago1731362543
0x1393ad73...fd25c23a5
0.0033 ETH
211672572024-11-11 21:54:2321 days ago1731362063
0x1393ad73...fd25c23a5
0.00331092 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
BuyAndBurn

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 20 runs

Other Settings:
default evmVersion
File 1 of 27 : BuyAndBurn.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.6;
pragma abicoder v2;

import "../interfaces/IUniswapV3Factory.sol";
import "../interfaces/IUniswapV3Pool.sol";
import "../interfaces/INonfungiblePositionManager.sol";
import "./openzeppelin/security/ReentrancyGuard.sol";

import "../libs/PoolAddress.sol";
import "../libs/CallbackValidation.sol";
import "../libs/TransferHelper.sol";
import "../libs/FullMath.sol";

import "../interfaces/IWETH9.sol";
import "../interfaces/ITITANX.sol";
import "../libs/Constant.sol";

contract BuyAndBurn is ReentrancyGuard {
    /** @dev genesis timestamp */
    uint256 private immutable i_genesisTs;

    /** @dev titanx address */
    address private s_titanxAddress;
    /** @dev owner address */
    address private s_ownerAddress;
    /** @dev titanx weth uniswapv3 pool address */
    address private s_poolAddress;
    /** @dev is initial LP created */
    InitialLPCreated private s_initialLiquidityCreated;

    /** @dev tracks collect fees (weth) for buyandburn */
    uint88 private s_feesBuyAndBurn;

    /** @dev tracks total buyandburn from weth exclude weth fees */
    uint256 private s_totalWethBuyAndBurn;
    /** @dev tracks total buyandburn from fees (weth) */
    uint256 private s_totalWethFeesBuyAndBurn;

    /** @dev tracks titan burned through buyandburn */
    uint256 private s_totalTitanBuyAndBurn;
    /** @dev tracks total titan burned from fees (titanx) */
    uint256 private s_totalTitanFeesBurn;

    /** @dev tracks current global swap cap */
    uint256 private s_globalSwapCap = START_GLOBAL_SWAP_CAP;
    /** @dev tracks current per swap cap */
    uint256 private s_capPerSwap = START_PER_SWAP_CAP;

    /** @dev store position token info, only one full range position */
    TokenInfo private s_tokenInfo;

    //structs
    struct TokenInfo {
        uint80 tokenId;
        uint128 liquidity;
        int24 tickLower;
        int24 tickUpper;
    }

    event BoughtAndBurned(
        uint256 indexed weth,
        uint256 indexed titan,
        address indexed caller
    );
    event CollectedFees(
        uint256 indexed weth,
        uint256 indexed titan,
        address indexed caller
    );

    constructor(address ownerAddress) {
        require(ownerAddress != address(0), "InvalidAddress");
        i_genesisTs = block.timestamp;
        s_ownerAddress = ownerAddress;
    }

    /** @notice receive eth and convert all eth into weth */
    receive() external payable {
        //prevent ETH withdrawal received from WETH contract into deposit function
        if (msg.sender != WETH9) IWETH9(WETH9).deposit{value: msg.value}();
    }

    /** @notice remove owner */
    function renounceOwnership() public {
        require(msg.sender == s_ownerAddress, "InvalidCaller");
        s_ownerAddress = address(0);
    }

    /** @notice set new owner address. Only callable by owner address.
     * @param ownerAddress new owner address
     */
    function setOwnerAddress(address ownerAddress) external {
        require(msg.sender == s_ownerAddress, "InvalidCaller");
        require(ownerAddress != address(0), "InvalidAddress");
        s_ownerAddress = ownerAddress;
    }

    /** @notice set titanx address. Only callable by owner address.
     * @param titanxAddress titanx contract address
     */
    function setTitanContractAddress(address titanxAddress) external {
        require(msg.sender == s_ownerAddress, "InvalidCaller");
        require(s_titanxAddress == address(0), "CannotResetAddress");
        require(titanxAddress != address(0), "InvalidAddress");
        s_titanxAddress = titanxAddress;
    }

    /**
     * @notice set global buy and burn Weth cap. Only callable by owner address.
     * @param amount amount in 18 decimals
     */
    function setGlobalWethBuyAndBurnCap(uint256 amount) external {
        require(msg.sender == s_ownerAddress, "InvalidCaller");
        require(amount > s_globalSwapCap, "MustBeGreaterAmount");
        s_globalSwapCap = amount;
    }

    /**
     * @notice set weth cap amount per buynburn call. Only callable by owner address.
     * @param amount amount in 18 decimals
     */
    function setCapPerSwap(uint256 amount) external {
        require(msg.sender == s_ownerAddress, "InvalidCaller");
        require(amount >= START_PER_SWAP_CAP, "Min1WETH");
        s_capPerSwap = amount;
    }

    /** @notice burn all Titan in BuyAndBurn address */
    function burnLPTitan() public {
        ITITANX(s_titanxAddress).burnLPTokens();
    }

    /** @notice buy and burn Titan from uniswap pool */
    function buynBurn() public nonReentrant {
        require(
            s_initialLiquidityCreated == InitialLPCreated.YES,
            "NeedInitialLP"
        );

        uint256 globalWethCap = s_globalSwapCap;
        uint256 totalWethBuyAndBurn = s_totalWethBuyAndBurn +
            s_totalWethFeesBuyAndBurn;
        require(totalWethBuyAndBurn < globalWethCap, "ReachMaxGlobalCap");

        uint256 wethAmount = getWethBalance(address(this));
        require(wethAmount != 0, "NoAvailableFunds");

        uint256 wethCap = s_capPerSwap;
        if (wethAmount > wethCap) wethAmount = wethCap;
        if (totalWethBuyAndBurn + wethAmount > globalWethCap) {
            wethAmount = globalWethCap - totalWethBuyAndBurn;
            //due to incentive fees, we add 0.5% of the weth amount to make sure we can hit the global cap after incentive fees deduction
            wethAmount += (wethAmount * 50) / 10000;
            //at this point, if the amount is greater than the balance,
            //means the above addition amount difference is within the 0.5% added on top, then just use all the balance
            uint256 balance = getWethBalance(address(this));
            if (wethAmount > balance) wethAmount = balance;
        }

        //update s_totalWethFeesBuyAndBurn from collected fees
        uint256 feeFunds = s_feesBuyAndBurn;
        if (feeFunds != 0) {
            if (wethAmount < feeFunds) {
                feeFunds = wethAmount;
                s_feesBuyAndBurn -= uint88(feeFunds);
            } else {
                s_feesBuyAndBurn = 0;
            }
            //deduct out the incentive fees from s_feesBuyAndBurn
            feeFunds -= (feeFunds * INCENTIVE_FEE) / INCENTIVE_FEE_PERCENT_BASE;
            s_totalWethFeesBuyAndBurn += feeFunds;
        }

        uint256 incentiveFee = (wethAmount * INCENTIVE_FEE) /
            INCENTIVE_FEE_PERCENT_BASE;
        IWETH9(WETH9).withdraw(incentiveFee);

        wethAmount -= incentiveFee;
        //update s_totalWethBuyAndBurn which excludes collected fees
        if (wethAmount - feeFunds > 0)
            s_totalWethBuyAndBurn += wethAmount - feeFunds;

        _swapWETHForTitan(wethAmount);
        TransferHelper.safeTransferETH(payable(msg.sender), incentiveFee);
    }

    /** @notice Used by uniswapV3. Modified from uniswapV3 swap callback function to complete the swap */
    function uniswapV3SwapCallback(
        int256 amount0Delta,
        int256 amount1Delta,
        bytes calldata
    ) external {
        require(amount0Delta > 0 || amount1Delta > 0); // swaps entirely within 0-liquidity regions are not supported
        IUniswapV3Pool pool = CallbackValidation.verifyCallback(
            UNISWAPV3FACTORY,
            WETH9,
            s_titanxAddress,
            POOLFEE1PERCENT
        );
        require(address(pool) == s_poolAddress, "WrongPool");

        //swap weth for titan
        TransferHelper.safeTransferFrom(
            WETH9,
            address(this),
            msg.sender,
            amount0Delta > 0 ? uint256(amount0Delta) : uint256(amount1Delta)
        );
    }

    /** @notice One-time function to create initial pool to initialize with the desired price ratio.
     * To avoid being front run, must call this function right after contract is deployed and titanx address is set.
     */
    function createInitialPool() public {
        require(s_poolAddress == address(0), "PoolHasCreated");
        require(s_titanxAddress != address(0), "InvalidTitanxAddress");
        _createPool();
    }

    /** @notice One-time function to create initial liquidity pool. Require 28 Weth to execute. */
    function createInitialLiquidity() public {
        require(s_poolAddress != address(0), "NoPoolExists");
        if (s_initialLiquidityCreated == InitialLPCreated.YES) return;
        require(getWethBalance(address(this)) >= INITIAL_LP_WETH, "Need8WETH");

        s_initialLiquidityCreated = InitialLPCreated.YES;

        // Approve the position manager
        TransferHelper.safeApprove(
            s_titanxAddress,
            NONFUNGIBLEPOSITIONMANAGER,
            type(uint256).max
        );
        TransferHelper.safeApprove(
            WETH9,
            NONFUNGIBLEPOSITIONMANAGER,
            type(uint256).max
        );

        ITITANX(s_titanxAddress).mintLPTokens();
        _mintPosition();
    }

    /** @notice collect fees from LP */
    function collectFees() public nonReentrant {
        (uint256 amount0, uint256 amount1) = _collectFees();
        uint256 titan;
        uint256 weth;
        if (WETH9 < s_titanxAddress) {
            weth = uint256(amount0 >= 0 ? amount0 : -amount0);
            titan = uint256(amount1 >= 0 ? amount1 : -amount1);
        } else {
            titan = uint256(amount0 >= 0 ? amount0 : -amount0);
            weth = uint256(amount1 >= 0 ? amount1 : -amount1);
        }

        s_totalTitanFeesBurn += titan;
        s_feesBuyAndBurn += uint88(weth);
        burnLPTitan();
        emit CollectedFees(weth, titan, msg.sender);
    }

    // ==================== Private Functions =======================================
    /** @dev sort tokens in ascending order, that's how uniswap identify the pair
     * @return token0 token address that is digitally smaller than token1
     * @return token1 token address that is digitally larger than token0
     * @return amount0 LP amount for token0
     * @return amount1 LP amount for token1
     */
    function _getTokensConfig()
        private
        view
        returns (
            address token0,
            address token1,
            uint256 amount0,
            uint256 amount1
        )
    {
        token0 = WETH9;
        token1 = s_titanxAddress;
        amount0 = INITIAL_LP_WETH;
        amount1 = INITIAL_LP_TITAN;
        if (s_titanxAddress < WETH9) {
            token0 = s_titanxAddress;
            token1 = WETH9;
            amount0 = INITIAL_LP_TITAN;
            amount1 = INITIAL_LP_WETH;
        }
    }

    /** @dev create pool with the preset sqrt price ratio */
    function _createPool() private {
        (address token0, address token1, , ) = _getTokensConfig();
        s_poolAddress = INonfungiblePositionManager(NONFUNGIBLEPOSITIONMANAGER)
            .createAndInitializePoolIfNecessary(
                token0,
                token1,
                POOLFEE1PERCENT,
                WETH9 < s_titanxAddress
                    ? INITIAL_SQRTPRICE_WETH_TITANX
                    : INITIAL_SQRTPRICE_TITANX_WETH
            );
    }

    /** @dev mint full range LP token */
    function _mintPosition() private {
        (
            address token0,
            address token1,
            uint256 amount0Desired,
            uint256 amount1Desired
        ) = _getTokensConfig();

        INonfungiblePositionManager.MintParams
            memory params = INonfungiblePositionManager.MintParams({
                token0: token0,
                token1: token1,
                fee: POOLFEE1PERCENT,
                tickLower: MIN_TICK,
                tickUpper: MAX_TICK,
                amount0Desired: amount0Desired,
                amount1Desired: amount1Desired,
                amount0Min: (amount0Desired * 90) / 100,
                amount1Min: (amount1Desired * 90) / 100,
                recipient: address(this),
                deadline: block.timestamp + 600
            });

        (uint256 tokenId, uint256 liquidity, , ) = INonfungiblePositionManager(
            NONFUNGIBLEPOSITIONMANAGER
        ).mint(params);

        s_tokenInfo.tokenId = uint80(tokenId);
        s_tokenInfo.liquidity = uint128(liquidity);
        s_tokenInfo.tickLower = MIN_TICK;
        s_tokenInfo.tickUpper = MAX_TICK;
    }

    /** @dev call uniswapv3 collect funtion to collect LP fees
     * @return amount0 token0 amount
     * @return amount1 token1 amount
     */
    function _collectFees() private returns (uint256 amount0, uint256 amount1) {
        INonfungiblePositionManager.CollectParams
            memory params = INonfungiblePositionManager.CollectParams(
                s_tokenInfo.tokenId,
                address(this),
                type(uint128).max,
                type(uint128).max
            );
        (amount0, amount1) = INonfungiblePositionManager(
            NONFUNGIBLEPOSITIONMANAGER
        ).collect(params);
    }

    /** @dev call uniswap swap function to swap weth for titan, then burn all titan
     * @param amountWETH weth amount
     */
    function _swapWETHForTitan(uint256 amountWETH) private {
        (int256 amount0, int256 amount1) = IUniswapV3Pool(s_poolAddress).swap(
            address(this),
            WETH9 < s_titanxAddress,
            int256(amountWETH),
            WETH9 < s_titanxAddress ? MIN_SQRT_RATIO + 1 : MAX_SQRT_RATIO - 1,
            ""
        );
        uint256 titan = WETH9 < s_titanxAddress
            ? uint256(amount1 >= 0 ? amount1 : -amount1)
            : uint256(amount0 >= 0 ? amount0 : -amount0);
        s_totalTitanBuyAndBurn += titan;
        burnLPTitan();
        emit BoughtAndBurned(amountWETH, titan, msg.sender);
    }

    //views
    /** @notice get titanx weth pool address
     * @return address titanx weth pool address
     */
    function getPoolAddress() public view returns (address) {
        return s_poolAddress;
    }

    /** @notice get contract ETH balance
     * @return balance contract ETH balance
     */
    function getBalance() public view returns (uint256) {
        return address(this).balance;
    }

    /** @notice get WETH balance for speciifed address
     * @param account address
     * @return balance WETH balance
     */
    function getWethBalance(address account) public view returns (uint256) {
        return IWETH9(WETH9).balanceOf(account);
    }

    /** @notice get titan balance for speicifed address
     * @param account address
     */
    function getTitanBalance(address account) public view returns (uint256) {
        return ITITANX(s_titanxAddress).balanceOf(account);
    }

    /** @notice get buy and burn current contract day
     * @return day current contract day
     */
    function getCurrentContractDay() public view returns (uint256) {
        return ((block.timestamp - i_genesisTs) / SECONDS_IN_DAY) + 1;
    }

    /** @notice get buy and burn funds (exclude weth fees)
     * @return amount weth amount
     */
    function getBuyAndBurnFunds() public view returns (uint256) {
        return getWethBalance(address(this)) - s_feesBuyAndBurn;
    }

    /** @notice get buy and burn funds from weth fees only
     * @return amount weth amount
     */
    function getFeesBuyAndBurnFunds() public view returns (uint256) {
        return s_feesBuyAndBurn;
    }

    /** @notice get total weth amount used to buy and burn (exclude weth fees)
     * @return amount total weth amount
     */
    function getTotalWethBuyAndBurn() public view returns (uint256) {
        return s_totalWethBuyAndBurn;
    }

    /** @notice get total weth amount from fees only used to buy and burn
     * @return amount total weth amount
     */
    function getTotalWethFeesBuyAndBurn() public view returns (uint256) {
        return s_totalWethFeesBuyAndBurn;
    }

    /** @notice get total titan amount burned from all buy and burn
     * @return amount total titan amount
     */
    function getTotalTitanBuyAndBurn() public view returns (uint256) {
        return s_totalTitanBuyAndBurn;
    }

    /** @notice get total titan amount burned from collected LP fees
     * @return amount total titan amount
     */
    function getTotalTitanFeesBurn() public view returns (uint256) {
        return s_totalTitanFeesBurn;
    }

    /** @notice get LP token info
     * @return tokenId tokenId
     * @return liquidity liquidity
     * @return tickLower tickLower
     * @return tickUpper tickUpper
     */
    function getTokenInfo()
        public
        view
        returns (
            uint256 tokenId,
            uint256 liquidity,
            int24 tickLower,
            int24 tickUpper
        )
    {
        return (
            s_tokenInfo.tokenId,
            s_tokenInfo.liquidity,
            s_tokenInfo.tickLower,
            s_tokenInfo.tickUpper
        );
    }

    /** @notice get LP token URI
     * @return uri URI
     */
    function getTokenURI() public view returns (string memory) {
        return
            INonfungiblePositionManager(NONFUNGIBLEPOSITIONMANAGER).tokenURI(1);
    }

    /** @notice get current sqrt price
     * @return sqrtPrice sqrt Price X96
     */
    function getCurrentSqrtPriceX96() public view returns (uint160) {
        IUniswapV3Pool pool = IUniswapV3Pool(s_poolAddress);
        (uint160 sqrtPriceX96, , , , , , ) = pool.slot0();
        return sqrtPriceX96;
    }

    /** @notice get current eth price
     * @return ethPrice eth price
     */
    function getCurrentEthPrice() public view returns (uint256) {
        IUniswapV3Pool pool = IUniswapV3Pool(s_poolAddress);
        (uint256 sqrtPriceX96, , , , , , ) = pool.slot0();
        uint256 numerator1 = sqrtPriceX96 * sqrtPriceX96;
        uint256 numerator2 = 10 ** 18;
        uint256 price = FullMath.mulDiv(numerator1, numerator2, 1 << 192);
        price = WETH9 < s_titanxAddress ? (1 ether * 1 ether) / price : price;
        return price;
    }

    /** @notice get titanx address
     * @return titanxAddress titanx address
     */
    function gettitanxAddress() public view returns (address) {
        return s_titanxAddress;
    }

    /** @notice get global buy and burn cap
     * @return cap amount
     */
    function getGlobalWethBuyAndBurnCap() public view returns (uint256) {
        return s_globalSwapCap;
    }

    /** @notice get cap amount per buy and burn
     * @return cap amount
     */
    function getWethBuyAndBurnCap() public view returns (uint256) {
        return s_capPerSwap;
    }
}

File 2 of 27 : Constant.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.6;

enum InitialLPCreated {
    NO,
    YES
}
enum Liquidity {
    Increase,
    Mint
}

address constant UNISWAPV3FACTORY = 0x1F98431c8aD98523631AE4a59f267346ea31F984;
address constant NONFUNGIBLEPOSITIONMANAGER = 0xC36442b4a4522E871399CD717aBDD847Ab11FE88;
address constant WETH9 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;

uint256 constant SECONDS_IN_DAY = 86400;
uint256 constant INITIAL_LP_TITAN = 100_000_000_000 ether;
uint256 constant INITIAL_LP_WETH = 8 ether;
uint160 constant INITIAL_SQRTPRICE_WETH_TITANX = 8857977855714785514805085808036300;
uint160 constant INITIAL_SQRTPRICE_TITANX_WETH = 708638228457182841184406;

uint24 constant POOLFEE1PERCENT = 10000; //1% Fee
int24 constant MIN_TICK = -887200;
int24 constant MAX_TICK = 887200;
uint160 constant MIN_SQRT_RATIO = 4295128739;
uint160 constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;

uint256 constant INCENTIVE_FEE = 3300;
uint256 constant INCENTIVE_FEE_PERCENT_BASE = 1_000_000;

uint256 constant START_GLOBAL_SWAP_CAP = 80 ether;
uint256 constant START_PER_SWAP_CAP = 1 ether;

File 3 of 27 : ITITANX.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.6;

interface ITITANX {
    function mintLPTokens() external;

    function burnLPTokens() external;

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

File 4 of 27 : IWETH9.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity =0.7.6;

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

/// @title Interface for WETH9
interface IWETH9 is IERC20 {
    /// @notice Deposit ether to get wrapped ether
    function deposit() external payable;

    /// @notice Withdraw wrapped ether to get ether
    function withdraw(uint256) external;
}

File 5 of 27 : FullMath.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.0 <0.8.0;

/// @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(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
    /// @param a The multiplicand
    /// @param b The multiplier
    /// @param denominator The divisor
    /// @return result The 256-bit result
    /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv
    function mulDiv(
        uint256 a,
        uint256 b,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        // 512-bit multiply [prod1 prod0] = a * b
        // Compute the product mod 2**256 and mod 2**256 - 1
        // then 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(a, b, not(0))
            prod0 := mul(a, b)
            prod1 := sub(sub(mm, prod0), lt(mm, prod0))
        }

        // Handle non-overflow cases, 256 by 256 division
        if (prod1 == 0) {
            require(denominator > 0);
            assembly {
                result := div(prod0, denominator)
            }
            return result;
        }

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

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

        // Make division exact by subtracting the remainder from [prod1 prod0]
        // Compute remainder using mulmod
        uint256 remainder;
        assembly {
            remainder := mulmod(a, b, denominator)
        }
        // Subtract 256 bit number from 512 bit number
        assembly {
            prod1 := sub(prod1, gt(remainder, prod0))
            prod0 := sub(prod0, remainder)
        }

        // Factor powers of two out of denominator
        // Compute largest power of two divisor of denominator.
        // Always >= 1.
        uint256 twos = -denominator & denominator;
        // Divide denominator by power of two
        assembly {
            denominator := div(denominator, twos)
        }

        // Divide [prod1 prod0] by the factors of two
        assembly {
            prod0 := div(prod0, twos)
        }
        // Shift in bits from prod1 into prod0. For this we need
        // to flip `twos` such that it is 2**256 / twos.
        // If twos is zero, then it becomes one
        assembly {
            twos := add(div(sub(0, twos), twos), 1)
        }
        prod0 |= prod1 * twos;

        // Invert denominator mod 2**256
        // Now that denominator is an odd number, it has an inverse
        // modulo 2**256 such that denominator * inv = 1 mod 2**256.
        // Compute the inverse by starting with a seed that is correct
        // correct for four bits. That is, denominator * inv = 1 mod 2**4
        uint256 inv = (3 * denominator) ^ 2;
        // Now use 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.
        inv *= 2 - denominator * inv; // inverse mod 2**8
        inv *= 2 - denominator * inv; // inverse mod 2**16
        inv *= 2 - denominator * inv; // inverse mod 2**32
        inv *= 2 - denominator * inv; // inverse mod 2**64
        inv *= 2 - denominator * inv; // inverse mod 2**128
        inv *= 2 - denominator * inv; // 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 precoditions 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 * inv;
        return result;
    }

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

File 6 of 27 : TransferHelper.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.6.0;

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

library TransferHelper {
    /// @notice Transfers tokens from the targeted address to the given destination
    /// @notice Errors with 'STF' if transfer fails
    /// @param token The contract address of the token to be transferred
    /// @param from The originating address from which the tokens will be transferred
    /// @param to The destination address of the transfer
    /// @param value The amount to be transferred
    function safeTransferFrom(
        address token,
        address from,
        address to,
        uint256 value
    ) internal {
        (bool success, bytes memory data) = token.call(
            abi.encodeWithSelector(
                IERC20.transferFrom.selector,
                from,
                to,
                value
            )
        );
        require(
            success && (data.length == 0 || abi.decode(data, (bool))),
            "STF"
        );
    }

    /// @notice Transfers tokens from msg.sender to a recipient
    /// @dev Errors with ST if transfer fails
    /// @param token The contract address of the token which will be transferred
    /// @param to The recipient of the transfer
    /// @param value The value of the transfer
    function safeTransfer(address token, address to, uint256 value) internal {
        (bool success, bytes memory data) = token.call(
            abi.encodeWithSelector(IERC20.transfer.selector, to, value)
        );
        require(
            success && (data.length == 0 || abi.decode(data, (bool))),
            "ST"
        );
    }

    /// @notice Approves the stipulated contract to spend the given allowance in the given token
    /// @dev Errors with 'SA' if transfer fails
    /// @param token The contract address of the token to be approved
    /// @param to The target of the approval
    /// @param value The amount of the given token the target will be allowed to spend
    function safeApprove(address token, address to, uint256 value) internal {
        (bool success, bytes memory data) = token.call(
            abi.encodeWithSelector(IERC20.approve.selector, to, value)
        );
        require(
            success && (data.length == 0 || abi.decode(data, (bool))),
            "SA"
        );
    }

    /// @notice Transfers ETH to the recipient address
    /// @dev Fails with `STE`
    /// @param to The destination of the transfer
    /// @param value The value to be transferred
    function safeTransferETH(address to, uint256 value) internal {
        (bool success, ) = to.call{value: value}(new bytes(0));
        require(success, "STE");
    }
}

File 7 of 27 : CallbackValidation.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity =0.7.6;

import "../interfaces/IUniswapV3Pool.sol";
import "./PoolAddress.sol";

/// @notice Provides validation for callbacks from Uniswap V3 Pools
library CallbackValidation {
    /// @notice Returns the address of a valid Uniswap V3 Pool
    /// @param factory The contract address of the Uniswap V3 factory
    /// @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 V3 pool contract address
    function verifyCallback(
        address factory,
        address tokenA,
        address tokenB,
        uint24 fee
    ) internal view returns (IUniswapV3Pool pool) {
        return
            verifyCallback(
                factory,
                PoolAddress.getPoolKey(tokenA, tokenB, fee)
            );
    }

    /// @notice Returns the address of a valid Uniswap V3 Pool
    /// @param factory The contract address of the Uniswap V3 factory
    /// @param poolKey The identifying key of the V3 pool
    /// @return pool The V3 pool contract address
    function verifyCallback(
        address factory,
        PoolAddress.PoolKey memory poolKey
    ) internal view returns (IUniswapV3Pool pool) {
        pool = IUniswapV3Pool(PoolAddress.computeAddress(factory, poolKey));
        require(msg.sender == address(pool));
    }
}

File 8 of 27 : 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(
            uint256(
                keccak256(
                    abi.encodePacked(
                        hex"ff",
                        factory,
                        keccak256(abi.encode(key.token0, key.token1, key.fee)),
                        POOL_INIT_CODE_HASH
                    )
                )
            )
        );
    }
}

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

pragma solidity ^0.7.6;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

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

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }
}

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

import "../contracts/openzeppelin/token/ERC721/IERC721Metadata.sol";
import "../contracts/openzeppelin/token/ERC721/IERC721Enumerable.sol";

import "./IPoolInitializer.sol";
import "./IERC721Permit.sol";
import "./IPeripheryPayments.sol";
import "./IPeripheryImmutableState.sol";
import "../libs/PoolAddress.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 11 of 27 : IUniswapV3Pool.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

import "./pool/IUniswapV3PoolImmutables.sol";
import "./pool/IUniswapV3PoolState.sol";
import "./pool/IUniswapV3PoolDerivedState.sol";
import "./pool/IUniswapV3PoolActions.sol";
import "./pool/IUniswapV3PoolOwnerActions.sol";
import "./pool/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 12 of 27 : IUniswapV3Factory.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @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 13 of 27 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

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

/// @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 15 of 27 : IUniswapV3PoolOwnerActions.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @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 16 of 27 : IUniswapV3PoolActions.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @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 17 of 27 : IUniswapV3PoolDerivedState.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @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 18 of 27 : IUniswapV3PoolState.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @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 19 of 27 : IUniswapV3PoolImmutables.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @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 20 of 27 : 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 21 of 27 : 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 22 of 27 : IERC721Permit.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;

import "../contracts/openzeppelin/token/ERC721/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 23 of 27 : 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 24 of 27 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.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 tokenId);

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

File 25 of 27 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.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 26 of 27 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.7.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 27 of 27 : IERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.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);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"ownerAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"weth","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"titan","type":"uint256"},{"indexed":true,"internalType":"address","name":"caller","type":"address"}],"name":"BoughtAndBurned","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"weth","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"titan","type":"uint256"},{"indexed":true,"internalType":"address","name":"caller","type":"address"}],"name":"CollectedFees","type":"event"},{"inputs":[],"name":"burnLPTitan","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"buynBurn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"collectFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"createInitialLiquidity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"createInitialPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBuyAndBurnFunds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentContractDay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentEthPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentSqrtPriceX96","outputs":[{"internalType":"uint160","name":"","type":"uint160"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFeesBuyAndBurnFunds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getGlobalWethBuyAndBurnCap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPoolAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getTitanBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTokenInfo","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalTitanBuyAndBurn","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalTitanFeesBurn","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalWethBuyAndBurn","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalWethFeesBuyAndBurn","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getWethBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getWethBuyAndBurnCap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gettitanxAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"setCapPerSwap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"setGlobalWethBuyAndBurnCap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"ownerAddress","type":"address"}],"name":"setOwnerAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"titanxAddress","type":"address"}],"name":"setTitanContractAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"uniswapV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

60a06040526804563918244f400000600855670de0b6b3a76400006009553480156200002a57600080fd5b5060405162002401380380620024018339810160408190526200004d91620000ae565b60016000556001600160a01b038116620000845760405162461bcd60e51b81526004016200007b90620000de565b60405180910390fd5b42608052600280546001600160a01b0319166001600160a01b039290921691909117905562000106565b600060208284031215620000c0578081fd5b81516001600160a01b0381168114620000d7578182fd5b9392505050565b6020808252600e908201526d496e76616c69644164647265737360901b604082015260600190565b6080516122e0620001216000398061058a52506122e06000f3fe6080604052600436106101565760003560e01c8063098dada5146101da5780630f7f7d24146101fa57806312065fe01461022557806313c108db1461023a5780631ae409c01461025a578063331a6bf51461026f5780633b20250c1461028f57806347f591a9146102af5780634b409045146102c4578063715018a6146102d957806371a0314b146102ee5780637510270a1461030357806377756ad2146103235780637fdbb7d4146103385780637fec4bed1461035a5780638c6d1a2f1461036f5780639125009d1461038f578063abb1dc44146103a4578063ad2eb63d146103c9578063b12bea12146103de578063bed18ec8146103f3578063c179306c14610408578063c87965721461041d578063cb4677c614610432578063cc01779114610447578063d4a191161461045c578063f586c6d91461047e578063fa461e3314610493578063fccfdceb146104b3576101d5565b366101d5573360008051602061228b833981519152146101d35760008051602061228b8339815191526001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b1580156101b957600080fd5b505af11580156101cd573d6000803e3d6000fd5b50505050505b005b600080fd5b3480156101e657600080fd5b506101d36101f5366004611dca565b6104c8565b34801561020657600080fd5b5061020f610528565b60405161021c9190611ef0565b60405180910390f35b34801561023157600080fd5b5061020f61052e565b34801561024657600080fd5b506101d3610255366004611dca565b610532565b34801561026657600080fd5b5061020f610582565b34801561027b57600080fd5b506101d361028a366004611bbf565b6105b0565b34801561029b57600080fd5b5061020f6102aa366004611bbf565b610622565b3480156102bb57600080fd5b5061020f6106ae565b3480156102d057600080fd5b506101d36106b4565b3480156102e557600080fd5b506101d361070f565b3480156102fa57600080fd5b506101d361074b565b34801561030f57600080fd5b5061020f61031e366004611bbf565b6108a7565b34801561032f57600080fd5b5061020f6108d8565b34801561034457600080fd5b5061034d6108de565b60405161021c9190611e72565b34801561036657600080fd5b5061034d6108ed565b34801561037b57600080fd5b506101d361038a366004611bbf565b61097c565b34801561039b57600080fd5b5061020f610a17565b3480156103b057600080fd5b506103b9610b16565b60405161021c9493929190612225565b3480156103d557600080fd5b5061020f610b52565b3480156103ea57600080fd5b5061020f610b77565b3480156103ff57600080fd5b506101d3610b7d565b34801561041457600080fd5b506101d3610be7565b34801561042957600080fd5b506101d3610ddf565b34801561043e57600080fd5b5061020f610ea2565b34801561045357600080fd5b5061020f610ea8565b34801561046857600080fd5b50610471610ebe565b60405161021c9190611ef9565b34801561048a57600080fd5b5061034d610f52565b34801561049f57600080fd5b506101d36104ae366004611c1a565b610f61565b3480156104bf57600080fd5b5061020f61101a565b6002546001600160a01b031633146104fb5760405162461bcd60e51b81526004016104f29061206f565b60405180910390fd5b670de0b6b3a76400008110156105235760405162461bcd60e51b81526004016104f290611fa9565b600955565b60045490565b4790565b6002546001600160a01b0316331461055c5760405162461bcd60e51b81526004016104f29061206f565b600854811161057d5760405162461bcd60e51b81526004016104f29061201c565b600855565b6001620151807f00000000000000000000000000000000000000000000000000000000000000004203040190565b6002546001600160a01b031633146105da5760405162461bcd60e51b81526004016104f29061206f565b6001600160a01b0381166106005760405162461bcd60e51b81526004016104f290611f2c565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6040516370a0823160e01b815260009060008051602061228b833981519152906370a0823190610656908590600401611e72565b60206040518083038186803b15801561066e57600080fd5b505afa158015610682573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106a69190611de2565b90505b919050565b60055490565b6003546001600160a01b0316156106dd5760405162461bcd60e51b81526004016104f2906120c2565b6001546001600160a01b03166107055760405162461bcd60e51b81526004016104f290611fcb565b61070d611020565b565b6002546001600160a01b031633146107395760405162461bcd60e51b81526004016104f29061206f565b600280546001600160a01b0319169055565b6003546001600160a01b03166107735760405162461bcd60e51b81526004016104f290612049565b6001600354600160a01b900460ff16600181111561078d57fe5b14156107985761070d565b676f05b59d3b2000006107aa30610622565b10156107c85760405162461bcd60e51b81526004016104f290611ff9565b6003805460ff60a01b1916600160a01b179055600154610808906001600160a01b031673c36442b4a4522e871399cd717abdd847ab11fe8860001961112c565b61083760008051602061228b83398151915273c36442b4a4522e871399cd717abdd847ab11fe8860001961112c565b600160009054906101000a90046001600160a01b03166001600160a01b031663e3d3227d6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561088757600080fd5b505af115801561089b573d6000803e3d6000fd5b5050505061070d611273565b6001546040516370a0823160e01b81526000916001600160a01b0316906370a0823190610656908590600401611e72565b60075490565b6001546001600160a01b031690565b60035460408051633850c7bd60e01b815290516000926001600160a01b03169183918391633850c7bd9160048083019260e0929190829003018186803b15801561093657600080fd5b505afa15801561094a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061096e9190611d2a565b509497505050505050505090565b6002546001600160a01b031633146109a65760405162461bcd60e51b81526004016104f29061206f565b6001546001600160a01b0316156109cf5760405162461bcd60e51b81526004016104f290612096565b6001600160a01b0381166109f55760405162461bcd60e51b81526004016104f290611f2c565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b60035460408051633850c7bd60e01b815290516000926001600160a01b03169183918391633850c7bd9160048083019260e0929190829003018186803b158015610a6057600080fd5b505afa158015610a74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a989190611d2a565b5050506001600160a01b0393909316935050508180029050670de0b6b3a76400006000610aca8383600160c01b61140f565b6001549091506001600160a01b031660008051602061228b83398151915210610af35780610b0c565b806a0c097ce7bc90715b34b9f160241b81610b0a57fe5b045b9550505050505090565b600a546001600160501b038116906001600160801b03600160501b82041690600160d01b8104600290810b91600160e81b9004900b5b90919293565b600354600090600160a81b90046001600160581b0316610b7130610622565b03905090565b60095490565b600160009054906101000a90046001600160a01b03166001600160a01b031663bb88603c6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610bcd57600080fd5b505af1158015610be1573d6000803e3d6000fd5b50505050565b610bef6114bf565b6001600354600160a01b900460ff166001811115610c0957fe5b14610c265760405162461bcd60e51b81526004016104f2906120ea565b60085460055460045401818110610c4f5760405162461bcd60e51b81526004016104f290611f7e565b6000610c5a30610622565b905080610c795760405162461bcd60e51b81526004016104f290611f54565b60095480821115610c88578091505b838284011115610cbe5782840391506127106032830204820191506000610cae30610622565b905080831115610cbc578092505b505b600354600160a81b90046001600160581b03168015610d385780831015610d115750600380546001600160581b03600160a81b8083048216869003909116026001600160a81b0390911617905581610d21565b600380546001600160a81b031690555b60058054620f4240610ce484020490920391820190555b604051632e1a7d4d60e01b8152620f4240610ce48502049060008051602061228b83398151915290632e1a7d4d90610d74908490600401611ef0565b600060405180830381600087803b158015610d8e57600080fd5b505af1158015610da2573d6000803e3d6000fd5b50505093819003935081840315610dbe57600480548386030190555b610dc78461151e565b610dd13382611681565b50505050505061070d611775565b610de76114bf565b600080610df261177c565b600154919350915060009081906001600160a01b031660008051602061228b8339815191521015610e27575081905082610e2d565b50829050815b6007805483019055600380546001600160581b03600160a81b80830482168501909116026001600160a81b03909116179055610e67610b7d565b6040513390839083907fb3ff07f4fe20273bbc264b773aacc6325987f8b0b1aa4c5bdfe5b75fdbd1284c90600090a45050505061070d611775565b60065490565b600354600160a81b90046001600160581b031690565b60405163c87b56dd60e01b815260609073c36442b4a4522e871399cd717abdd847ab11fe889063c87b56dd90610ef990600190600401611ef0565b60006040518083038186803b158015610f1157600080fd5b505afa158015610f25573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610f4d9190810190611c94565b905090565b6003546001600160a01b031690565b6000841380610f705750600083135b610f7957600080fd5b600154600090610fba90731f98431c8ad98523631ae4a59f267346ea31f9849060008051602061228b833981519152906001600160a01b0316612710611843565b6003549091506001600160a01b03808316911614610fea5760405162461bcd60e51b81526004016104f290612111565b61101360008051602061228b83398151915230336000891361100c578761100e565b885b611862565b5050505050565b60085490565b60008061102b6119ba565b5050600154919350915073c36442b4a4522e871399cd717abdd847ab11fe88906313ead5629084908490612710906001600160a01b031660008051602061228b833981519152106110865769960f5af78f8fcb5aa096611097565b6e01b4bb661cabdb0796fed90f0b09cc5b6040518563ffffffff1660e01b81526004016110b69493929190611ec0565b602060405180830381600087803b1580156110d057600080fd5b505af11580156110e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111089190611bdb565b600380546001600160a01b0319166001600160a01b03929092169190911790555050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663095ea7b360e01b1781529251825160009485949389169392918291908083835b602083106111a85780518252601f199092019160209182019101611189565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d806000811461120a576040519150601f19603f3d011682016040523d82523d6000602084013e61120f565b606091505b509150915081801561123d57508051158061123d575080806020019051602081101561123a57600080fd5b50515b611013576040805162461bcd60e51b8152602060048201526002602482015261534160f01b604482015290519081900360640190fd5b6000806000806112816119ba565b93509350935093506000604051806101600160405280866001600160a01b03168152602001856001600160a01b0316815260200161271062ffffff168152602001620d899f1960020b8152602001620d89a060020b8152602001848152602001838152602001606485605a02816112f457fe5b0481526020016064605a8502048152306020820152610258420160409182015251634418b22b60e11b8152909150600090819073c36442b4a4522e871399cd717abdd847ab11fe8890638831645690611351908690600401612177565b608060405180830381600087803b15801561136b57600080fd5b505af115801561137f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a39190611dfa565b5050600a80546001600160501b0319166001600160501b039390931692909217600160501b600160d01b0319166001600160801b0391909116600160501b021762ffffff60d01b1916620793b360d51b176001600160e81b0316616c4d60ed1b17905550505050505050565b6000808060001985870986860292508281109083900303905080611445576000841161143a57600080fd5b5082900490506114b8565b80841161145157600080fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150505b9392505050565b60026000541415611517576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600055565b60035460015460009182916001600160a01b039182169163128acb089130911660008051602061228b83398151915210868161156e5773fffd8963efd1fc6a506488495d951d5263988d25611575565b6401000276a45b6040518563ffffffff1660e01b81526004016115949493929190611e86565b6040805180830381600087803b1580156115ad57600080fd5b505af11580156115c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115e59190611bf7565b60015491935091506000906001600160a01b031660008051602061228b8339815191521061162657600083121561161f5782600003611621565b825b61163a565b6000821215611638578160000361163a565b815b6006805482019055905061164c610b7d565b6040513390829086907f1b6fe3d614107093562b62b9236e265cac820f430060c5eb674a70824a7435db90600090a450505050565b604080516000808252602082019092526001600160a01b0384169083906040518082805190602001908083835b602083106116cd5780518252601f1990920191602091820191016116ae565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811461172f576040519150601f19603f3d011682016040523d82523d6000602084013e611734565b606091505b5050905080611770576040805162461bcd60e51b815260206004820152600360248201526253544560e81b604482015290519081900360640190fd5b505050565b6001600055565b60408051608081018252600a546001600160501b031681523060208201526001600160801b038183018190526060820152905163fc6f786560e01b8152600091829173c36442b4a4522e871399cd717abdd847ab11fe889063fc6f7865906117e8908490600401612134565b6040805180830381600087803b15801561180157600080fd5b505af1158015611815573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118399190611e43565b9094909350915050565b600061185985611854868686611a2f565b611a85565b95945050505050565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b178152925182516000948594938a169392918291908083835b602083106118e65780518252601f1990920191602091820191016118c7565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611948576040519150601f19603f3d011682016040523d82523d6000602084013e61194d565b606091505b509150915081801561197b57508051158061197b575080806020019051602081101561197857600080fd5b50515b6119b2576040805162461bcd60e51b815260206004820152600360248201526229aa2360e91b604482015290519081900360640190fd5b505050505050565b60015460008051602061228b833981519152906001600160a01b0316676f05b59d3b200000680a18f07d736b90be55601d1b83831015610b4c5750506001546001600160a01b03169260008051602061228b8339815191529250680a18f07d736b90be55601d1b9150676f05b59d3b20000090565b611a37611b8d565b826001600160a01b0316846001600160a01b03161115611a55579192915b50604080516060810182526001600160a01b03948516815292909316602083015262ffffff169181019190915290565b6000611a918383611aae565b9050336001600160a01b03821614611aa857600080fd5b92915050565b600081602001516001600160a01b031682600001516001600160a01b031610611ad657600080fd5b50805160208083015160409384015184516001600160a01b0394851681850152939091168385015262ffffff166060808401919091528351808403820181526080840185528051908301206001600160f81b031960a085015294901b6001600160601b03191660a183015260b58201939093527fe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b5460d5808301919091528251808303909101815260f5909101909152805191012090565b604080516060810182526000808252602082018190529181019190915290565b805161ffff811681146106a957600080fd5b600060208284031215611bd0578081fd5b81356114b881612272565b600060208284031215611bec578081fd5b81516114b881612272565b60008060408385031215611c09578081fd5b505080516020909101519092909150565b60008060008060608587031215611c2f578182fd5b843593506020850135925060408501356001600160401b0380821115611c53578384fd5b818701915087601f830112611c66578384fd5b813581811115611c74578485fd5b886020828501011115611c85578485fd5b95989497505060200194505050565b600060208284031215611ca5578081fd5b81516001600160401b0380821115611cbb578283fd5b818401915084601f830112611cce578283fd5b815181811115611cda57fe5b604051601f8201601f191681016020018381118282101715611cf857fe5b604052818152838201602001871015611d0f578485fd5b611d20826020830160208701612246565b9695505050505050565b600080600080600080600060e0888a031215611d44578283fd5b8751611d4f81612272565b8097505060208801518060020b8114611d66578384fd5b9550611d7460408901611bad565b9450611d8260608901611bad565b9350611d9060808901611bad565b925060a088015160ff81168114611da5578283fd5b60c08901519092508015158114611dba578182fd5b8091505092959891949750929550565b600060208284031215611ddb578081fd5b5035919050565b600060208284031215611df3578081fd5b5051919050565b60008060008060808587031215611e0f578384fd5b845160208601519094506001600160801b0381168114611e2d578384fd5b6040860151606090960151949790965092505050565b60008060408385031215611c09578182fd5b6001600160a01b03169052565b60020b9052565b62ffffff169052565b6001600160a01b0391909116815260200190565b6001600160a01b03948516815292151560208401526040830191909152909116606082015260a06080820181905260009082015260c00190565b6001600160a01b039485168152928416602084015262ffffff919091166040830152909116606082015260800190565b90815260200190565b6000602082528251806020840152611f18816040850160208701612246565b601f01601f19169190910160400192915050565b6020808252600e908201526d496e76616c69644164647265737360901b604082015260600190565b60208082526010908201526f4e6f417661696c61626c6546756e647360801b604082015260600190565b602080825260119082015270052656163684d6178476c6f62616c43617607c1b604082015260600190565b60208082526008908201526709ad2dc62ae8aa8960c31b604082015260600190565b602080825260149082015273496e76616c6964546974616e784164647265737360601b604082015260600190565b60208082526009908201526809ccacac870ae8aa8960bb1b604082015260600190565b602080825260139082015272135d5cdd109951dc99585d195c905b5bdd5b9d606a1b604082015260600190565b6020808252600c908201526b4e6f506f6f6c45786973747360a01b604082015260600190565b6020808252600d908201526c24b73b30b634b221b0b63632b960991b604082015260600190565b60208082526012908201527143616e6e6f7452657365744164647265737360701b604082015260600190565b6020808252600e908201526d141bdbdb12185cd0dc99585d195960921b604082015260600190565b6020808252600d908201526c04e656564496e697469616c4c5609c1b604082015260600190565b60208082526009908201526815dc9bdb99d41bdbdb60ba1b604082015260600190565b815181526020808301516001600160a01b0316908201526040808301516001600160801b0390811691830191909152606092830151169181019190915260800190565b60006101608201905061218b828451611e55565b602083015161219d6020840182611e55565b5060408301516121b06040840182611e69565b5060608301516121c36060840182611e62565b5060808301516121d66080840182611e62565b5060a083015160a083015260c083015160c083015260e083015160e08301526101008084015181840152506101208084015161221482850182611e55565b505061014092830151919092015290565b9384526020840192909252600290810b60408401520b606082015260800190565b60005b83811015612261578181015183820152602001612249565b83811115610be15750506000910152565b6001600160a01b038116811461228757600080fd5b5056fe000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2a264697066735822122081e87268e909d56724af979ed294c04de921cafdfc2f7606672f7c528b45e02664736f6c6343000706003300000000000000000000000010129f3fe44dd32745d6e64e5d84cb84a524f114

Deployed Bytecode

0x6080604052600436106101565760003560e01c8063098dada5146101da5780630f7f7d24146101fa57806312065fe01461022557806313c108db1461023a5780631ae409c01461025a578063331a6bf51461026f5780633b20250c1461028f57806347f591a9146102af5780634b409045146102c4578063715018a6146102d957806371a0314b146102ee5780637510270a1461030357806377756ad2146103235780637fdbb7d4146103385780637fec4bed1461035a5780638c6d1a2f1461036f5780639125009d1461038f578063abb1dc44146103a4578063ad2eb63d146103c9578063b12bea12146103de578063bed18ec8146103f3578063c179306c14610408578063c87965721461041d578063cb4677c614610432578063cc01779114610447578063d4a191161461045c578063f586c6d91461047e578063fa461e3314610493578063fccfdceb146104b3576101d5565b366101d5573360008051602061228b833981519152146101d35760008051602061228b8339815191526001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b1580156101b957600080fd5b505af11580156101cd573d6000803e3d6000fd5b50505050505b005b600080fd5b3480156101e657600080fd5b506101d36101f5366004611dca565b6104c8565b34801561020657600080fd5b5061020f610528565b60405161021c9190611ef0565b60405180910390f35b34801561023157600080fd5b5061020f61052e565b34801561024657600080fd5b506101d3610255366004611dca565b610532565b34801561026657600080fd5b5061020f610582565b34801561027b57600080fd5b506101d361028a366004611bbf565b6105b0565b34801561029b57600080fd5b5061020f6102aa366004611bbf565b610622565b3480156102bb57600080fd5b5061020f6106ae565b3480156102d057600080fd5b506101d36106b4565b3480156102e557600080fd5b506101d361070f565b3480156102fa57600080fd5b506101d361074b565b34801561030f57600080fd5b5061020f61031e366004611bbf565b6108a7565b34801561032f57600080fd5b5061020f6108d8565b34801561034457600080fd5b5061034d6108de565b60405161021c9190611e72565b34801561036657600080fd5b5061034d6108ed565b34801561037b57600080fd5b506101d361038a366004611bbf565b61097c565b34801561039b57600080fd5b5061020f610a17565b3480156103b057600080fd5b506103b9610b16565b60405161021c9493929190612225565b3480156103d557600080fd5b5061020f610b52565b3480156103ea57600080fd5b5061020f610b77565b3480156103ff57600080fd5b506101d3610b7d565b34801561041457600080fd5b506101d3610be7565b34801561042957600080fd5b506101d3610ddf565b34801561043e57600080fd5b5061020f610ea2565b34801561045357600080fd5b5061020f610ea8565b34801561046857600080fd5b50610471610ebe565b60405161021c9190611ef9565b34801561048a57600080fd5b5061034d610f52565b34801561049f57600080fd5b506101d36104ae366004611c1a565b610f61565b3480156104bf57600080fd5b5061020f61101a565b6002546001600160a01b031633146104fb5760405162461bcd60e51b81526004016104f29061206f565b60405180910390fd5b670de0b6b3a76400008110156105235760405162461bcd60e51b81526004016104f290611fa9565b600955565b60045490565b4790565b6002546001600160a01b0316331461055c5760405162461bcd60e51b81526004016104f29061206f565b600854811161057d5760405162461bcd60e51b81526004016104f29061201c565b600855565b6001620151807f00000000000000000000000000000000000000000000000000000000653cb37f4203040190565b6002546001600160a01b031633146105da5760405162461bcd60e51b81526004016104f29061206f565b6001600160a01b0381166106005760405162461bcd60e51b81526004016104f290611f2c565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6040516370a0823160e01b815260009060008051602061228b833981519152906370a0823190610656908590600401611e72565b60206040518083038186803b15801561066e57600080fd5b505afa158015610682573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106a69190611de2565b90505b919050565b60055490565b6003546001600160a01b0316156106dd5760405162461bcd60e51b81526004016104f2906120c2565b6001546001600160a01b03166107055760405162461bcd60e51b81526004016104f290611fcb565b61070d611020565b565b6002546001600160a01b031633146107395760405162461bcd60e51b81526004016104f29061206f565b600280546001600160a01b0319169055565b6003546001600160a01b03166107735760405162461bcd60e51b81526004016104f290612049565b6001600354600160a01b900460ff16600181111561078d57fe5b14156107985761070d565b676f05b59d3b2000006107aa30610622565b10156107c85760405162461bcd60e51b81526004016104f290611ff9565b6003805460ff60a01b1916600160a01b179055600154610808906001600160a01b031673c36442b4a4522e871399cd717abdd847ab11fe8860001961112c565b61083760008051602061228b83398151915273c36442b4a4522e871399cd717abdd847ab11fe8860001961112c565b600160009054906101000a90046001600160a01b03166001600160a01b031663e3d3227d6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561088757600080fd5b505af115801561089b573d6000803e3d6000fd5b5050505061070d611273565b6001546040516370a0823160e01b81526000916001600160a01b0316906370a0823190610656908590600401611e72565b60075490565b6001546001600160a01b031690565b60035460408051633850c7bd60e01b815290516000926001600160a01b03169183918391633850c7bd9160048083019260e0929190829003018186803b15801561093657600080fd5b505afa15801561094a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061096e9190611d2a565b509497505050505050505090565b6002546001600160a01b031633146109a65760405162461bcd60e51b81526004016104f29061206f565b6001546001600160a01b0316156109cf5760405162461bcd60e51b81526004016104f290612096565b6001600160a01b0381166109f55760405162461bcd60e51b81526004016104f290611f2c565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b60035460408051633850c7bd60e01b815290516000926001600160a01b03169183918391633850c7bd9160048083019260e0929190829003018186803b158015610a6057600080fd5b505afa158015610a74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a989190611d2a565b5050506001600160a01b0393909316935050508180029050670de0b6b3a76400006000610aca8383600160c01b61140f565b6001549091506001600160a01b031660008051602061228b83398151915210610af35780610b0c565b806a0c097ce7bc90715b34b9f160241b81610b0a57fe5b045b9550505050505090565b600a546001600160501b038116906001600160801b03600160501b82041690600160d01b8104600290810b91600160e81b9004900b5b90919293565b600354600090600160a81b90046001600160581b0316610b7130610622565b03905090565b60095490565b600160009054906101000a90046001600160a01b03166001600160a01b031663bb88603c6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610bcd57600080fd5b505af1158015610be1573d6000803e3d6000fd5b50505050565b610bef6114bf565b6001600354600160a01b900460ff166001811115610c0957fe5b14610c265760405162461bcd60e51b81526004016104f2906120ea565b60085460055460045401818110610c4f5760405162461bcd60e51b81526004016104f290611f7e565b6000610c5a30610622565b905080610c795760405162461bcd60e51b81526004016104f290611f54565b60095480821115610c88578091505b838284011115610cbe5782840391506127106032830204820191506000610cae30610622565b905080831115610cbc578092505b505b600354600160a81b90046001600160581b03168015610d385780831015610d115750600380546001600160581b03600160a81b8083048216869003909116026001600160a81b0390911617905581610d21565b600380546001600160a81b031690555b60058054620f4240610ce484020490920391820190555b604051632e1a7d4d60e01b8152620f4240610ce48502049060008051602061228b83398151915290632e1a7d4d90610d74908490600401611ef0565b600060405180830381600087803b158015610d8e57600080fd5b505af1158015610da2573d6000803e3d6000fd5b50505093819003935081840315610dbe57600480548386030190555b610dc78461151e565b610dd13382611681565b50505050505061070d611775565b610de76114bf565b600080610df261177c565b600154919350915060009081906001600160a01b031660008051602061228b8339815191521015610e27575081905082610e2d565b50829050815b6007805483019055600380546001600160581b03600160a81b80830482168501909116026001600160a81b03909116179055610e67610b7d565b6040513390839083907fb3ff07f4fe20273bbc264b773aacc6325987f8b0b1aa4c5bdfe5b75fdbd1284c90600090a45050505061070d611775565b60065490565b600354600160a81b90046001600160581b031690565b60405163c87b56dd60e01b815260609073c36442b4a4522e871399cd717abdd847ab11fe889063c87b56dd90610ef990600190600401611ef0565b60006040518083038186803b158015610f1157600080fd5b505afa158015610f25573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610f4d9190810190611c94565b905090565b6003546001600160a01b031690565b6000841380610f705750600083135b610f7957600080fd5b600154600090610fba90731f98431c8ad98523631ae4a59f267346ea31f9849060008051602061228b833981519152906001600160a01b0316612710611843565b6003549091506001600160a01b03808316911614610fea5760405162461bcd60e51b81526004016104f290612111565b61101360008051602061228b83398151915230336000891361100c578761100e565b885b611862565b5050505050565b60085490565b60008061102b6119ba565b5050600154919350915073c36442b4a4522e871399cd717abdd847ab11fe88906313ead5629084908490612710906001600160a01b031660008051602061228b833981519152106110865769960f5af78f8fcb5aa096611097565b6e01b4bb661cabdb0796fed90f0b09cc5b6040518563ffffffff1660e01b81526004016110b69493929190611ec0565b602060405180830381600087803b1580156110d057600080fd5b505af11580156110e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111089190611bdb565b600380546001600160a01b0319166001600160a01b03929092169190911790555050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663095ea7b360e01b1781529251825160009485949389169392918291908083835b602083106111a85780518252601f199092019160209182019101611189565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d806000811461120a576040519150601f19603f3d011682016040523d82523d6000602084013e61120f565b606091505b509150915081801561123d57508051158061123d575080806020019051602081101561123a57600080fd5b50515b611013576040805162461bcd60e51b8152602060048201526002602482015261534160f01b604482015290519081900360640190fd5b6000806000806112816119ba565b93509350935093506000604051806101600160405280866001600160a01b03168152602001856001600160a01b0316815260200161271062ffffff168152602001620d899f1960020b8152602001620d89a060020b8152602001848152602001838152602001606485605a02816112f457fe5b0481526020016064605a8502048152306020820152610258420160409182015251634418b22b60e11b8152909150600090819073c36442b4a4522e871399cd717abdd847ab11fe8890638831645690611351908690600401612177565b608060405180830381600087803b15801561136b57600080fd5b505af115801561137f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a39190611dfa565b5050600a80546001600160501b0319166001600160501b039390931692909217600160501b600160d01b0319166001600160801b0391909116600160501b021762ffffff60d01b1916620793b360d51b176001600160e81b0316616c4d60ed1b17905550505050505050565b6000808060001985870986860292508281109083900303905080611445576000841161143a57600080fd5b5082900490506114b8565b80841161145157600080fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150505b9392505050565b60026000541415611517576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600055565b60035460015460009182916001600160a01b039182169163128acb089130911660008051602061228b83398151915210868161156e5773fffd8963efd1fc6a506488495d951d5263988d25611575565b6401000276a45b6040518563ffffffff1660e01b81526004016115949493929190611e86565b6040805180830381600087803b1580156115ad57600080fd5b505af11580156115c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115e59190611bf7565b60015491935091506000906001600160a01b031660008051602061228b8339815191521061162657600083121561161f5782600003611621565b825b61163a565b6000821215611638578160000361163a565b815b6006805482019055905061164c610b7d565b6040513390829086907f1b6fe3d614107093562b62b9236e265cac820f430060c5eb674a70824a7435db90600090a450505050565b604080516000808252602082019092526001600160a01b0384169083906040518082805190602001908083835b602083106116cd5780518252601f1990920191602091820191016116ae565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811461172f576040519150601f19603f3d011682016040523d82523d6000602084013e611734565b606091505b5050905080611770576040805162461bcd60e51b815260206004820152600360248201526253544560e81b604482015290519081900360640190fd5b505050565b6001600055565b60408051608081018252600a546001600160501b031681523060208201526001600160801b038183018190526060820152905163fc6f786560e01b8152600091829173c36442b4a4522e871399cd717abdd847ab11fe889063fc6f7865906117e8908490600401612134565b6040805180830381600087803b15801561180157600080fd5b505af1158015611815573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118399190611e43565b9094909350915050565b600061185985611854868686611a2f565b611a85565b95945050505050565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b178152925182516000948594938a169392918291908083835b602083106118e65780518252601f1990920191602091820191016118c7565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611948576040519150601f19603f3d011682016040523d82523d6000602084013e61194d565b606091505b509150915081801561197b57508051158061197b575080806020019051602081101561197857600080fd5b50515b6119b2576040805162461bcd60e51b815260206004820152600360248201526229aa2360e91b604482015290519081900360640190fd5b505050505050565b60015460008051602061228b833981519152906001600160a01b0316676f05b59d3b200000680a18f07d736b90be55601d1b83831015610b4c5750506001546001600160a01b03169260008051602061228b8339815191529250680a18f07d736b90be55601d1b9150676f05b59d3b20000090565b611a37611b8d565b826001600160a01b0316846001600160a01b03161115611a55579192915b50604080516060810182526001600160a01b03948516815292909316602083015262ffffff169181019190915290565b6000611a918383611aae565b9050336001600160a01b03821614611aa857600080fd5b92915050565b600081602001516001600160a01b031682600001516001600160a01b031610611ad657600080fd5b50805160208083015160409384015184516001600160a01b0394851681850152939091168385015262ffffff166060808401919091528351808403820181526080840185528051908301206001600160f81b031960a085015294901b6001600160601b03191660a183015260b58201939093527fe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b5460d5808301919091528251808303909101815260f5909101909152805191012090565b604080516060810182526000808252602082018190529181019190915290565b805161ffff811681146106a957600080fd5b600060208284031215611bd0578081fd5b81356114b881612272565b600060208284031215611bec578081fd5b81516114b881612272565b60008060408385031215611c09578081fd5b505080516020909101519092909150565b60008060008060608587031215611c2f578182fd5b843593506020850135925060408501356001600160401b0380821115611c53578384fd5b818701915087601f830112611c66578384fd5b813581811115611c74578485fd5b886020828501011115611c85578485fd5b95989497505060200194505050565b600060208284031215611ca5578081fd5b81516001600160401b0380821115611cbb578283fd5b818401915084601f830112611cce578283fd5b815181811115611cda57fe5b604051601f8201601f191681016020018381118282101715611cf857fe5b604052818152838201602001871015611d0f578485fd5b611d20826020830160208701612246565b9695505050505050565b600080600080600080600060e0888a031215611d44578283fd5b8751611d4f81612272565b8097505060208801518060020b8114611d66578384fd5b9550611d7460408901611bad565b9450611d8260608901611bad565b9350611d9060808901611bad565b925060a088015160ff81168114611da5578283fd5b60c08901519092508015158114611dba578182fd5b8091505092959891949750929550565b600060208284031215611ddb578081fd5b5035919050565b600060208284031215611df3578081fd5b5051919050565b60008060008060808587031215611e0f578384fd5b845160208601519094506001600160801b0381168114611e2d578384fd5b6040860151606090960151949790965092505050565b60008060408385031215611c09578182fd5b6001600160a01b03169052565b60020b9052565b62ffffff169052565b6001600160a01b0391909116815260200190565b6001600160a01b03948516815292151560208401526040830191909152909116606082015260a06080820181905260009082015260c00190565b6001600160a01b039485168152928416602084015262ffffff919091166040830152909116606082015260800190565b90815260200190565b6000602082528251806020840152611f18816040850160208701612246565b601f01601f19169190910160400192915050565b6020808252600e908201526d496e76616c69644164647265737360901b604082015260600190565b60208082526010908201526f4e6f417661696c61626c6546756e647360801b604082015260600190565b602080825260119082015270052656163684d6178476c6f62616c43617607c1b604082015260600190565b60208082526008908201526709ad2dc62ae8aa8960c31b604082015260600190565b602080825260149082015273496e76616c6964546974616e784164647265737360601b604082015260600190565b60208082526009908201526809ccacac870ae8aa8960bb1b604082015260600190565b602080825260139082015272135d5cdd109951dc99585d195c905b5bdd5b9d606a1b604082015260600190565b6020808252600c908201526b4e6f506f6f6c45786973747360a01b604082015260600190565b6020808252600d908201526c24b73b30b634b221b0b63632b960991b604082015260600190565b60208082526012908201527143616e6e6f7452657365744164647265737360701b604082015260600190565b6020808252600e908201526d141bdbdb12185cd0dc99585d195960921b604082015260600190565b6020808252600d908201526c04e656564496e697469616c4c5609c1b604082015260600190565b60208082526009908201526815dc9bdb99d41bdbdb60ba1b604082015260600190565b815181526020808301516001600160a01b0316908201526040808301516001600160801b0390811691830191909152606092830151169181019190915260800190565b60006101608201905061218b828451611e55565b602083015161219d6020840182611e55565b5060408301516121b06040840182611e69565b5060608301516121c36060840182611e62565b5060808301516121d66080840182611e62565b5060a083015160a083015260c083015160c083015260e083015160e08301526101008084015181840152506101208084015161221482850182611e55565b505061014092830151919092015290565b9384526020840192909252600290810b60408401520b606082015260800190565b60005b83811015612261578181015183820152602001612249565b83811115610be15750506000910152565b6001600160a01b038116811461228757600080fd5b5056fe000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2a264697066735822122081e87268e909d56724af979ed294c04de921cafdfc2f7606672f7c528b45e02664736f6c63430007060033

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

00000000000000000000000010129f3fe44dd32745d6e64e5d84cb84a524f114

-----Decoded View---------------
Arg [0] : ownerAddress (address): 0x10129f3Fe44dD32745D6E64E5d84cB84a524F114

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 00000000000000000000000010129f3fe44dd32745d6e64e5d84cb84a524f114


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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