ETH Price: $2,437.38 (-2.06%)

Contract

0x48165A4b84e00347C4f9a13b6D0aD8f7aE290bB8
 

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Withdraw Token164261032023-01-17 11:04:47629 days ago1673953487IN
0x48165A4b...7aE290bB8
0 ETH0.0029064813.43772774
Withdraw Token162789282022-12-27 22:00:23650 days ago1672178423IN
0x48165A4b...7aE290bB8
0 ETH0.0151423270.00840493
Withdraw Token162774522022-12-27 17:03:47650 days ago1672160627IN
0x48165A4b...7aE290bB8
0 ETH0.0034274117.20649539
Withdraw Token162181932022-12-19 10:38:35658 days ago1671446315IN
0x48165A4b...7aE290bB8
0 ETH0.0025069511.59054353
Withdraw Token159702642022-11-14 19:07:35693 days ago1668452855IN
0x48165A4b...7aE290bB8
0 ETH0.0035605617.8749559
Claim Reward159702562022-11-14 19:05:59693 days ago1668452759IN
0x48165A4b...7aE290bB8
0 ETH0.001644519.16742523
Withdraw Token159631312022-11-13 19:15:35694 days ago1668366935IN
0x48165A4b...7aE290bB8
0 ETH0.0050246523.23079474
Withdraw Token159618302022-11-13 14:54:59694 days ago1668351299IN
0x48165A4b...7aE290bB8
0 ETH0.0031145115.63567673
Withdraw Token159582492022-11-13 2:54:35694 days ago1668308075IN
0x48165A4b...7aE290bB8
0 ETH0.0020861611.45659852
Claim Reward159103762022-11-06 10:27:47701 days ago1667730467IN
0x48165A4b...7aE290bB8
0 ETH0.0009696511.04425117
Withdraw Token158809072022-11-02 7:40:47705 days ago1667374847IN
0x48165A4b...7aE290bB8
0 ETH0.0018550311.27301883
Claim Reward158795502022-11-02 3:08:11705 days ago1667358491IN
0x48165A4b...7aE290bB8
0 ETH0.0010718412.4927583
Withdraw Token158693772022-10-31 16:56:47707 days ago1667235407IN
0x48165A4b...7aE290bB8
0 ETH0.0039123819.64115263
Withdraw Token158112902022-10-23 14:04:47715 days ago1666533887IN
0x48165A4b...7aE290bB8
0 ETH0.0032612315.07786404
Withdraw Token158030582022-10-22 10:29:59716 days ago1666434599IN
0x48165A4b...7aE290bB8
0 ETH0.0033982715.71144155
Claim Reward157899722022-10-20 14:41:59718 days ago1666276919IN
0x48165A4b...7aE290bB8
0 ETH0.0037233942.40918564
Withdraw Token157802472022-10-19 6:04:59719 days ago1666159499IN
0x48165A4b...7aE290bB8
0 ETH0.0036020818.31321351
Claim Reward157781912022-10-18 23:10:47720 days ago1666134647IN
0x48165A4b...7aE290bB8
0 ETH0.0014737716.7861624
Withdraw Token157563782022-10-15 22:03:47723 days ago1665871427IN
0x48165A4b...7aE290bB8
0 ETH0.0040631418.78537709
Withdraw Token157538512022-10-15 13:35:35723 days ago1665840935IN
0x48165A4b...7aE290bB8
0 ETH0.0038624117.85732615
Withdraw Token157463042022-10-14 12:19:35724 days ago1665749975IN
0x48165A4b...7aE290bB8
0 ETH0.0046283423.53080825
Claim Reward157454642022-10-14 9:30:47724 days ago1665739847IN
0x48165A4b...7aE290bB8
0 ETH0.0012685614.78565539
Withdraw Token156926662022-10-07 0:33:23732 days ago1665102803IN
0x48165A4b...7aE290bB8
0 ETH0.001709048.68892043
Withdraw Token156926632022-10-07 0:32:35732 days ago1665102755IN
0x48165A4b...7aE290bB8
0 ETH0.00156976.55698223
Claim Reward156738662022-10-04 9:25:35734 days ago1664875535IN
0x48165A4b...7aE290bB8
0 ETH0.00055216.2884406
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
BaseGaugeV2UniV3

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 100 runs

Other Settings:
default evmVersion
File 1 of 38 : BaseGaugeV2UniV3.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma abicoder v2;

import {IUniswapV3Factory} from "@uniswap/v3-core/contracts/interfaces/IUniswapV3Factory.sol";
import {IUniswapV3Pool} from "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol";
import {IERC20} from "@openzeppelin/contracts/interfaces/IERC20.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";

import {RewardMath} from "../utils/RewardMath.sol";
import {INonfungiblePositionManager} from "../interfaces/INonfungiblePositionManager.sol";
import {IGaugeV2UniV3} from "../interfaces/IGaugeV2UniV3.sol";
import {IRegistry} from "../interfaces/IRegistry.sol";
import {NFTPositionInfo} from "../utils/NFTPositionInfo.sol";
import {Multicall} from "../utils/Multicall.sol";
import {TransferHelperExtended} from "../utils/TransferHelperExtended.sol";
import {PoolAddress} from "../utils/PoolAddress.sol";
import {IUniswapV3Staker} from "../interfaces/IUniswapV3Staker.sol";
import {INFTStaker} from "../interfaces/INFTStaker.sol";

/// @title Uniswap V3 canonical staking interface
contract BaseGaugeV2UniV3 is
    IGaugeV2UniV3,
    IUniswapV3Staker,
    Multicall,
    ReentrancyGuard
{
    IRegistry public immutable override registry;
    IUniswapV3Pool public immutable pool;

    uint256 public totalRewardUnclaimed;
    uint160 public totalSecondsClaimedX128;
    uint256 public startTime;
    uint256 public endTime;
    uint256 public constant DURATION = 2 hours; // rewards are released over 7 days

    /// @notice Represents the deposit of a liquidity NFT
    struct Deposit {
        address owner;
        int24 tickLower;
        int24 tickUpper;
    }

    /// @notice Represents a staked liquidity NFT
    struct Stake {
        uint160 secondsPerLiquidityInsideInitialX128;
        uint96 liquidityNoOverflow;
        uint128 liquidityIfOverflow;
        uint128 nonDerivedLiquidity;
    }

    /// @inheritdoc IUniswapV3Staker
    IUniswapV3Factory public override factory;

    /// @inheritdoc IUniswapV3Staker
    INonfungiblePositionManager public override nonfungiblePositionManager;

    /// @dev deposits[tokenId] => Deposit
    mapping(uint256 => Deposit) public override deposits;

    /// @dev stakes[tokenId] => Stake
    mapping(uint256 => Stake) private _stakes;

    uint256 public totalLiquiditySupply;

    /// @dev rewards[owner] => uint256
    /// @inheritdoc IUniswapV3Staker
    mapping(address => uint256) public override rewards;

    mapping(address => uint256) public override balanceOf;

    /// @dev Mapping from owner to list of owned token IDs
    mapping(address => mapping(uint256 => uint256)) private _ownedTokens;

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

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

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

    /// @param _nonfungiblePositionManager the NFT position manager contract address
    constructor(
        address token0,
        address token1,
        uint24 fee,
        address _registry,
        INonfungiblePositionManager _nonfungiblePositionManager
    ) {
        registry = IRegistry(_registry);
        nonfungiblePositionManager = _nonfungiblePositionManager;
        factory = IUniswapV3Factory(nonfungiblePositionManager.factory());
        pool = IUniswapV3Pool(factory.getPool(token0, token1, fee));
        startTime = block.timestamp;
    }

    /// @inheritdoc IUniswapV3Staker
    function stakes(uint256 tokenId)
        public
        view
        override
        returns (
            uint160 secondsPerLiquidityInsideInitialX128,
            uint128 liquidity
        )
    {
        Stake storage stake = _stakes[tokenId];
        secondsPerLiquidityInsideInitialX128 = stake
            .secondsPerLiquidityInsideInitialX128;
        liquidity = stake.liquidityNoOverflow;
        if (liquidity == type(uint96).max)
            liquidity = stake.liquidityIfOverflow;
    }

    /// @notice Upon receiving a Uniswap V3 ERC721, creates the token deposit setting owner to `from`. Also stakes token
    /// in one or more incentives if properly formatted `data` has a length > 0.
    function onERC721Received(
        address,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external override returns (bytes4) {
        require(
            msg.sender == address(nonfungiblePositionManager),
            "UniswapV3Staker::onERC721Received: not a univ3 nft"
        );

        (
            IUniswapV3Pool _pool,
            int24 tickLower,
            int24 tickUpper,
            uint128 _liquidity
        ) = NFTPositionInfo.getPositionInfo(
                factory,
                nonfungiblePositionManager,
                tokenId
            );

        deposits[tokenId] = Deposit({
            owner: from,
            tickLower: tickLower,
            tickUpper: tickUpper
        });

        require(
            _pool == pool,
            "UniswapV3Staker::stakeToken: token pool is not the right pool"
        );
        require(
            _liquidity > 0,
            "UniswapV3Staker::stakeToken: cannot stake token with 0 liquidity"
        );

        totalLiquiditySupply += uint256(_liquidity);
        uint128 liquidity = uint128(derivedLiquidity(_liquidity, from));

        (, uint160 secondsPerLiquidityInsideX128, ) = _pool
            .snapshotCumulativesInside(tickLower, tickUpper);

        if (liquidity >= type(uint96).max) {
            _stakes[tokenId] = Stake({
                secondsPerLiquidityInsideInitialX128: secondsPerLiquidityInsideX128,
                liquidityNoOverflow: type(uint96).max,
                liquidityIfOverflow: liquidity,
                nonDerivedLiquidity: _liquidity
            });
        } else {
            _stakes[tokenId] = Stake({
                secondsPerLiquidityInsideInitialX128: secondsPerLiquidityInsideX128,
                liquidityNoOverflow: uint96(liquidity),
                liquidityIfOverflow: 0,
                nonDerivedLiquidity: _liquidity
            });
        }

        _addTokenToAllTokensEnumeration(tokenId);
        _addTokenToOwnerEnumeration(from, tokenId);
        balanceOf[from] += 1;

        emit TokenStaked(tokenId, _liquidity);
        return this.onERC721Received.selector;
    }

    /// @inheritdoc IUniswapV3Staker
    function withdrawToken(uint256 tokenId) external override {
        // try to update rewards
        _updateReward(tokenId);

        totalLiquiditySupply -= uint256(_stakes[tokenId].nonDerivedLiquidity);

        require(
            deposits[tokenId].owner == msg.sender,
            "UniswapV3Staker::withdrawToken: only owner can withdraw token"
        );

        delete deposits[tokenId];
        delete _stakes[tokenId];

        _removeTokenFromOwnerEnumeration(msg.sender, tokenId);
        _removeTokenFromAllTokensEnumeration(tokenId);
        balanceOf[msg.sender] -= 1;

        emit TokenUnstaked(tokenId);

        nonfungiblePositionManager.safeTransferFrom(
            address(this),
            msg.sender,
            tokenId
        );
    }

    function _updateReward(uint256 tokenId) internal {
        Deposit memory deposit = deposits[tokenId];

        (
            uint160 secondsPerLiquidityInsideInitialX128,
            uint128 liquidity
        ) = stakes(tokenId);

        require(
            liquidity != 0,
            "UniswapV3Staker::unstakeToken: stake does not exist"
        );

        (, uint160 secondsPerLiquidityInsideX128, ) = pool
            .snapshotCumulativesInside(deposit.tickLower, deposit.tickUpper);

        (uint256 reward, uint160 secondsInsideX128) = RewardMath
            .computeRewardAmount(
                totalRewardUnclaimed,
                totalSecondsClaimedX128,
                startTime,
                endTime,
                liquidity,
                secondsPerLiquidityInsideInitialX128,
                secondsPerLiquidityInsideX128,
                block.timestamp
            );

        // if this overflows, e.g. after 2^32-1 full liquidity seconds have been claimed,
        // reward rate will fall drastically so it's safe
        totalSecondsClaimedX128 += secondsInsideX128;
        // reward is never greater than total reward unclaimed
        totalRewardUnclaimed -= reward;
        // this only overflows if a token has a total supply greater than type(uint256).max
        rewards[deposit.owner] += reward;
    }

    function _claimReward(uint256 tokenId, address to)
        internal
        returns (uint256)
    {
        _updateReward(tokenId);
        uint256 reward = rewards[msg.sender];
        rewards[msg.sender] -= reward;
        TransferHelperExtended.safeTransfer(registry.maha(), to, reward);
        emit RewardClaimed(to, reward);
        return reward;
    }

    /// @inheritdoc IUniswapV3Staker
    function claimRewards(uint256[] memory tokenIds, address to)
        external
        override
        returns (uint256)
    {
        uint256 reward;
        for (uint256 index = 0; index < tokenIds.length; index++) {
            reward += _claimReward(tokenIds[index], to);
        }
        return reward;
    }

    function claimReward(uint256 tokenId, address to)
        external
        override
        returns (uint256)
    {
        return _claimReward(tokenId, to);
    }

    function derivedLiquidity(uint256 liquidity, address account)
        public
        view
        returns (uint256)
    {
        uint256 _derived = (liquidity * 20) / 100;
        uint256 _adjusted = 0;
        uint256 _supply = IERC20(registry.locker()).totalSupply();

        if (_supply > 0) {
            _adjusted = INFTStaker(registry.staker()).balanceOf(account);
            _adjusted =
                (((totalLiquiditySupply * _adjusted) / _supply) * 80) /
                100;
        }

        // because of this we are able to max out the boost by 5x
        return Math.min((_derived + _adjusted), liquidity);
    }

    function boostedFactor(uint256 tokenId, address who)
        public
        view
        returns (
            uint256 original,
            uint256 boosted,
            uint256 factor
        )
    {
        (, , , uint128 _liquidity) = NFTPositionInfo.getPositionInfo(
            factory,
            nonfungiblePositionManager,
            tokenId
        );

        original = (_liquidity * 20) / 100;
        boosted = derivedLiquidity(_liquidity, who);
        factor = (original * 1e18) / boosted;
    }

    function left(address token) external view override returns (uint256) {
        return totalRewardUnclaimed;
    }

    /// @inheritdoc IUniswapV3Staker
    function isIdsWithinRange(uint256[] memory tokenIds)
        external
        view
        override
        returns (bool[] memory)
    {
        bool[] memory ret = new bool[](tokenIds.length);

        for (uint256 index = 0; index < tokenIds.length; index++) {
            uint256 tokenId = tokenIds[index];
            (
                IUniswapV3Pool _pool,
                int24 tickLower,
                int24 tickUpper,

            ) = NFTPositionInfo.getPositionInfo(
                    factory,
                    nonfungiblePositionManager,
                    tokenId
                );

            (, int24 tick, , , , , ) = _pool.slot0();
            ret[index] = tickLower < tick && tick < tickUpper;
        }

        return ret;
    }

    function incentives() external view override returns (uint256, uint160) {
        return (totalRewardUnclaimed, totalSecondsClaimedX128);
    }

    function notifyRewardAmount(address token, uint256 amount)
        external
        override
        nonReentrant
    {
        require(
            token == registry.maha(),
            "UniswapV3Staker::createIncentive: only maha allowed"
        );
        require(
            amount > 0,
            "UniswapV3Staker::createIncentive: reward must be positive"
        );

        totalRewardUnclaimed += amount;
        endTime = block.timestamp + DURATION;

        TransferHelperExtended.safeTransferFrom(
            registry.maha(),
            msg.sender,
            address(this),
            amount
        );

        emit IncentiveCreated(pool, startTime, endTime, amount);
    }

    function tokenOfOwnerByIndex(address owner, uint256 index)
        public
        view
        virtual
        override
        returns (uint256)
    {
        require(
            index < balanceOf[owner],
            "ERC721Enumerable: owner index out of bounds"
        );
        return _ownedTokens[owner][index];
    }

    function totalSupply() public view virtual override returns (uint256) {
        return _allTokens.length;
    }

    function tokenByIndex(uint256 index)
        public
        view
        virtual
        override
        returns (uint256)
    {
        require(
            index < totalSupply(),
            "ERC721Enumerable: global index out of bounds"
        );
        return _allTokens[index];
    }

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

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

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

        uint256 lastTokenIndex = balanceOf[from];
        uint256 tokenIndex = _ownedTokensIndex[tokenId];

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

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

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

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

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

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

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

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

File 2 of 38 : 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 3 of 38 : 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 4 of 38 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol)

pragma solidity ^0.8.0;

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

File 5 of 38 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @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() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

        _;

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

File 6 of 38 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

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

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

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

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

File 7 of 38 : RewardMath.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./FullMath.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";

/// @title Math for computing rewards
/// @notice Allows computing rewards given some parameters of stakes and incentives
library RewardMath {
    /// @notice Compute the amount of rewards owed given parameters of the incentive and stake
    /// @param totalRewardUnclaimed The total amount of unclaimed rewards left for an incentive
    /// @param totalSecondsClaimedX128 How many full liquidity-seconds have been already claimed for the incentive
    /// @param startTime When the incentive rewards began in epoch seconds
    /// @param endTime When rewards are no longer being dripped out in epoch seconds
    /// @param liquidity The amount of liquidity, assumed to be constant over the period over which the snapshots are measured
    /// @param secondsPerLiquidityInsideInitialX128 The seconds per liquidity of the liquidity tick range as of the beginning of the period
    /// @param secondsPerLiquidityInsideX128 The seconds per liquidity of the liquidity tick range as of the current block timestamp
    /// @param currentTime The current block timestamp, which must be greater than or equal to the start time
    /// @return reward The amount of rewards owed
    /// @return secondsInsideX128 The total liquidity seconds inside the position's range for the duration of the stake
    function computeRewardAmount(
        uint256 totalRewardUnclaimed,
        uint160 totalSecondsClaimedX128,
        uint256 startTime,
        uint256 endTime,
        uint128 liquidity,
        uint160 secondsPerLiquidityInsideInitialX128,
        uint160 secondsPerLiquidityInsideX128,
        uint256 currentTime
    ) internal pure returns (uint256 reward, uint160 secondsInsideX128) {
        // this should never be called before the start time
        assert(currentTime >= startTime);

        // this operation is safe, as the difference cannot be greater than 1/stake.liquidity
        secondsInsideX128 =
            (secondsPerLiquidityInsideX128 -
                secondsPerLiquidityInsideInitialX128) *
            liquidity;

        uint256 totalSecondsUnclaimedX128 = ((Math.max(endTime, currentTime) -
            startTime) << 128) - totalSecondsClaimedX128;

        reward = FullMath.mulDiv(
            totalRewardUnclaimed,
            secondsInsideX128,
            totalSecondsUnclaimedX128
        );
    }
}

File 8 of 38 : INonfungiblePositionManager.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma abicoder v2;

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

import "@uniswap/v3-periphery/contracts/interfaces/IPoolInitializer.sol";
import "@uniswap/v3-periphery/contracts/interfaces/IERC721Permit.sol";
import "@uniswap/v3-periphery/contracts/interfaces/IPeripheryPayments.sol";
import "@uniswap/v3-periphery/contracts/interfaces/IPeripheryImmutableState.sol";

import "../utils/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 9 of 38 : IGaugeV2UniV3.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

interface IGaugeV2UniV3 {
    function registry() external view returns (IRegistry);
}

File 10 of 38 : IRegistry.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import {IAccessControl} from "@openzeppelin/contracts/access/IAccessControl.sol";

interface IRegistry is IAccessControl {
    event MahaChanged(address indexed whom, address _old, address _new);
    event VoterChanged(address indexed whom, address _old, address _new);
    event LockerChanged(address indexed whom, address _old, address _new);
    event GovernorChanged(address indexed whom, address _old, address _new);
    event StakerChanged(address indexed whom, address _old, address _new);
    event EmissionControllerChanged(
        address indexed whom,
        address _old,
        address _new
    );

    function maha() external view returns (address);

    function gaugeVoter() external view returns (address);

    function locker() external view returns (address);

    function staker() external view returns (address);

    function emissionController() external view returns (address);

    function governor() external view returns (address);

    function getAllAddresses()
        external
        view
        returns (
            address,
            address,
            address,
            address,
            address
        );

    function ensureNotPaused() external;

    function setMAHA(address _new) external;

    function setEmissionController(address _new) external;

    function setStaker(address _new) external;

    function setVoter(address _new) external;

    function setLocker(address _new) external;

    function setGovernor(address _new) external;
}

File 11 of 38 : NFTPositionInfo.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;

import {INonfungiblePositionManager} from "../interfaces/INonfungiblePositionManager.sol";
import {IUniswapV3Factory} from "@uniswap/v3-core/contracts/interfaces/IUniswapV3Factory.sol";
import {IUniswapV3Pool} from "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol";

/// @notice Encapsulates the logic for getting info about a NFT token ID
library NFTPositionInfo {
    /// @param factory The address of the Uniswap V3 Factory used in computing the pool address
    /// @param nonfungiblePositionManager The address of the nonfungible position manager to query
    /// @param tokenId The unique identifier of an Uniswap V3 LP token
    /// @return pool The address of the Uniswap V3 pool
    /// @return tickLower The lower tick of the Uniswap V3 position
    /// @return tickUpper The upper tick of the Uniswap V3 position
    /// @return liquidity The amount of liquidity staked
    function getPositionInfo(
        IUniswapV3Factory factory,
        INonfungiblePositionManager nonfungiblePositionManager,
        uint256 tokenId
    )
        internal
        view
        returns (
            IUniswapV3Pool pool,
            int24 tickLower,
            int24 tickUpper,
            uint128 liquidity
        )
    {
        address token0;
        address token1;
        uint24 fee;
        (
            ,
            ,
            token0,
            token1,
            fee,
            tickLower,
            tickUpper,
            liquidity,
            ,
            ,
            ,

        ) = nonfungiblePositionManager.positions(tokenId);

        pool = IUniswapV3Pool(factory.getPool(token0, token1, fee));
    }
}

File 12 of 38 : Multicall.sol
// SPDX-License-Identifier: GPL-2.0-or-later

pragma solidity ^0.8.0;
pragma abicoder v2;

import '../interfaces/IMulticall.sol';

/// @title Multicall
/// @notice Enables calling multiple methods in a single call to the contract
abstract contract Multicall is IMulticall {
    /// @inheritdoc IMulticall
    function multicall(bytes[] calldata data) public payable override returns (bytes[] memory results) {
        results = new bytes[](data.length);
        for (uint256 i = 0; i < data.length; i++) {
            (bool success, bytes memory result) = address(this).delegatecall(data[i]);

            if (!success) {
                // Next 5 lines from https://ethereum.stackexchange.com/a/83577
                if (result.length < 68) revert();
                assembly {
                    result := add(result, 0x04)
                }
                revert(abi.decode(result, (string)));
            }

            results[i] = result;
        }
    }
}

File 13 of 38 : TransferHelperExtended.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;

import './TransferHelper.sol';
import '@openzeppelin/contracts/utils/Address.sol';

library TransferHelperExtended {
    using Address for address;

    /// @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 {
        require(token.isContract(), 'TransferHelperExtended::safeTransferFrom: call to non-contract');
        TransferHelper.safeTransferFrom(token, from, to, value);
    }

    /// @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 {
        require(token.isContract(), 'TransferHelperExtended::safeTransfer: call to non-contract');
        TransferHelper.safeTransfer(token, to, value);
    }
}

File 14 of 38 : PoolAddress.sol
// SPDX-License-Identifier: GPL-2.0-or-later

pragma solidity ^0.8.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(
            bytes20(
                keccak256(
                    abi.encodePacked(
                        hex'ff',
                        factory,
                        keccak256(abi.encode(key.token0, key.token1, key.fee)),
                        POOL_INIT_CODE_HASH
                    )
                )
            )
        );
    }
}

File 15 of 38 : IUniswapV3Staker.sol
// SPDX-License-Identifier: GPL-2.0-or-later

pragma solidity ^0.8.0;
pragma abicoder v2;

import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";

import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Factory.sol";
import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol";
import {IERC20} from "@openzeppelin/contracts/interfaces/IERC20.sol";
import "./INonfungiblePositionManager.sol";
import "./IMulticall.sol";

interface IUniswapV3Staker is IERC721Receiver, IMulticall {
    /// @notice The Uniswap V3 Factory
    function factory() external view returns (IUniswapV3Factory);

    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

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

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

    /// @notice The nonfungible position manager with which this staking contract is compatible
    function nonfungiblePositionManager()
        external
        view
        returns (INonfungiblePositionManager);

    /// @notice Represents a staking incentive
    /// @return totalRewardUnclaimed The amount of reward token not yet claimed by users
    /// @return totalSecondsClaimedX128 Total liquidity-seconds claimed, represented as a UQ32.128
    function incentives()
        external
        view
        returns (uint256 totalRewardUnclaimed, uint160 totalSecondsClaimedX128);

    /// @notice Returns information about a deposited NFT
    /// @return owner The owner of the deposited NFT
    /// @return tickLower The lower tick of the range
    /// @return tickUpper The upper tick of the range
    function deposits(uint256 tokenId)
        external
        view
        returns (
            address owner,
            int24 tickLower,
            int24 tickUpper
        );

    /// @notice Returns information about a deposited NFT
    /// @param depositOwner The owner of the deposited NFT
    /// @return uint256 The current no of nfts deposited by owner.
    function balanceOf(address depositOwner) external view returns (uint256);

    /// @notice Returns information about a staked liquidity NFT
    /// @param tokenId The ID of the staked token
    /// @return secondsPerLiquidityInsideInitialX128 secondsPerLiquidity represented as a UQ32.128
    /// @return liquidity The amount of liquidity in the NFT as of the last time the rewards were computed
    function stakes(uint256 tokenId)
        external
        view
        returns (
            uint160 secondsPerLiquidityInsideInitialX128,
            uint128 liquidity
        );

    /// @notice Returns amounts of reward tokens owed to a given address according to the last time all stakes were updated
    /// @param owner The owner for which the rewards owed are checked
    /// @return rewardsOwed The amount of the reward token claimable by the owner
    function rewards(address owner) external view returns (uint256 rewardsOwed);

    /// @notice checks if the given LP token ids are within their given liquidaty range or not
    function isIdsWithinRange(uint256[] memory tokenIds)
        external
        view
        returns (bool[] memory);

    function left(address token) external view returns (uint256);

    /// @notice Creates a new liquidity mining incentive program
    /// @param reward The amount of reward tokens to be distributed
    function notifyRewardAmount(address token, uint256 reward) external;

    /// @notice Withdraws a Uniswap V3 LP token `tokenId` from this contract to the recipient `to`
    /// @param tokenId The ID of the token
    function withdrawToken(uint256 tokenId) external;

    /// @param to The address where claimed rewards will be sent to
    /// @param tokenId The ID of the token
    /// @return reward The amount of reward tokens claimed
    function claimReward(uint256 tokenId, address to)
        external
        returns (uint256 reward);

    /// @param to The address where claimed rewards will be sent to
    /// @param tokenIds The IDs of the token
    /// @return reward The amount of reward tokens claimed
    function claimRewards(uint256[] memory tokenIds, address to)
        external
        returns (uint256 reward);

    /// @notice Event emitted when a liquidity mining incentive has been created
    /// @param pool The Uniswap V3 pool
    /// @param startTime The time when the incentive program begins
    /// @param endTime The time when rewards stop accruing
    /// @param reward The amount of reward tokens to be distributed
    event IncentiveCreated(
        IUniswapV3Pool indexed pool,
        uint256 startTime,
        uint256 endTime,
        uint256 reward
    );

    /// @notice Event emitted when a Uniswap V3 LP token has been staked
    /// @param tokenId The unique identifier of an Uniswap V3 LP token
    /// @param liquidity The amount of liquidity staked
    event TokenStaked(uint256 indexed tokenId, uint128 liquidity);

    /// @notice Event emitted when a Uniswap V3 LP token has been unstaked
    /// @param tokenId The unique identifier of an Uniswap V3 LP token
    event TokenUnstaked(uint256 indexed tokenId);

    /// @notice Event emitted when a reward token has been claimed
    /// @param to The address where claimed rewards were sent to
    /// @param reward The amount of reward tokens claimed
    event RewardClaimed(address indexed to, uint256 reward);
}

File 16 of 38 : INFTStaker.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import {IRegistry} from "./IRegistry.sol";
import {IVotes} from "@openzeppelin/contracts/governance/utils/IVotes.sol";

interface INFTStaker is IVotes {
    event Transfer(address indexed from, address indexed to, uint256 value);

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

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

    function decimals() external view returns (uint8);

    function totalSupply() external view returns (uint256);

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

    function getStakedBalance(address who) external view returns (uint256);

    function registry() external view returns (IRegistry);

    function stake(uint256 _tokenId) external;

    function isStaked(uint256 _tokenId) external view returns (bool);

    function _stakeFromLock(uint256 _tokenId) external;

    function unstake(uint256 _tokenId) external;

    event StakeNFT(
        address indexed who,
        address indexed owner,
        uint256 tokenId,
        uint256 amount
    );
    event UnstakeNFT(
        address indexed who,
        address indexed owner,
        uint256 tokenId,
        uint256 amount
    );
}

File 17 of 38 : 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 18 of 38 : 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 38 : 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 20 of 38 : 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 21 of 38 : 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 22 of 38 : 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 23 of 38 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 24 of 38 : FullMath.sol
// SPDX-License-Identifier: MIT
pragma solidity ^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 = (type(uint256).max - denominator + 1) & 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 25 of 38 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

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

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

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

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

pragma solidity ^0.8.0;

import "../IERC721.sol";

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

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

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

File 27 of 38 : 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 28 of 38 : IERC721Permit.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;

import '@openzeppelin/contracts/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 29 of 38 : 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 30 of 38 : 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 31 of 38 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev 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 32 of 38 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 34 of 38 : IMulticall.sol
// SPDX-License-Identifier: GPL-2.0-or-later

pragma solidity ^0.8.0;
pragma abicoder v2;

/// @title Multicall interface
/// @notice Enables calling multiple methods in a single call to the contract
interface IMulticall {
    /// @notice Call multiple functions in the current contract and return the data from all of them if they all succeed
    /// @dev The `msg.value` should not be trusted for any method callable from multicall.
    /// @param data The encoded function data for each of the calls to make to this contract
    /// @return results The results from each of the calls passed in via data
    function multicall(bytes[] calldata data) external payable returns (bytes[] memory results);
}

File 35 of 38 : TransferHelper.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;

import '@openzeppelin/contracts/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 36 of 38 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 37 of 38 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

File 38 of 38 : IVotes.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (governance/utils/IVotes.sol)
pragma solidity ^0.8.0;

/**
 * @dev Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts.
 *
 * _Available since v4.5._
 */
interface IVotes {
    /**
     * @dev Emitted when an account changes their delegate.
     */
    event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);

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

    /**
     * @dev Returns the current amount of votes that `account` has.
     */
    function getVotes(address account) external view returns (uint256);

    /**
     * @dev Returns the amount of votes that `account` had at the end of a past block (`blockNumber`).
     */
    function getPastVotes(address account, uint256 blockNumber) external view returns (uint256);

    /**
     * @dev Returns the total supply of votes available at the end of a past block (`blockNumber`).
     *
     * NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes.
     * Votes that have not been delegated are still part of total supply, even though they would not participate in a
     * vote.
     */
    function getPastTotalSupply(uint256 blockNumber) external view returns (uint256);

    /**
     * @dev Returns the delegate that `account` has chosen.
     */
    function delegates(address account) external view returns (address);

    /**
     * @dev Delegates votes from the sender to `delegatee`.
     */
    function delegate(address delegatee) external;

    /**
     * @dev Delegates votes from signer to `delegatee`.
     */
    function delegateBySig(
        address delegatee,
        uint256 nonce,
        uint256 expiry,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"address","name":"_registry","type":"address"},{"internalType":"contract INonfungiblePositionManager","name":"_nonfungiblePositionManager","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IUniswapV3Pool","name":"pool","type":"address"},{"indexed":false,"internalType":"uint256","name":"startTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"endTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"IncentiveCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"RewardClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint128","name":"liquidity","type":"uint128"}],"name":"TokenStaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"TokenUnstaked","type":"event"},{"inputs":[],"name":"DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"who","type":"address"}],"name":"boostedFactor","outputs":[{"internalType":"uint256","name":"original","type":"uint256"},{"internalType":"uint256","name":"boosted","type":"uint256"},{"internalType":"uint256","name":"factor","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"claimReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"internalType":"address","name":"to","type":"address"}],"name":"claimRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"deposits","outputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"address","name":"account","type":"address"}],"name":"derivedLiquidity","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"endTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"contract IUniswapV3Factory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"incentives","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint160","name":"","type":"uint160"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"isIdsWithinRange","outputs":[{"internalType":"bool[]","name":"","type":"bool[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"left","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"nonfungiblePositionManager","outputs":[{"internalType":"contract INonfungiblePositionManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"notifyRewardAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pool","outputs":[{"internalType":"contract IUniswapV3Pool","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"registry","outputs":[{"internalType":"contract IRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"stakes","outputs":[{"internalType":"uint160","name":"secondsPerLiquidityInsideInitialX128","type":"uint160"},{"internalType":"uint128","name":"liquidity","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"startTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalLiquiditySupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalRewardUnclaimed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSecondsClaimedX128","outputs":[{"internalType":"uint160","name":"","type":"uint160"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"withdrawToken","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60c06040523480156200001157600080fd5b506040516200315f3803806200315f8339810160408190526200003491620001c6565b6001600055606082901b6001600160601b031916608052600680546001600160a01b0319166001600160a01b0383169081179091556040805163c45a015560e01b8152905163c45a015591600480820192602092909190829003018186803b158015620000a057600080fd5b505afa158015620000b5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000db9190620001a0565b600580546001600160a01b0319166001600160a01b03928316908117909155604051630b4c774160e11b81528783166004820152918616602483015262ffffff8516604483015290631698ee829060640160206040518083038186803b1580156200014557600080fd5b505afa1580156200015a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001809190620001a0565b60601b6001600160601b03191660a0525050426003555062000264915050565b600060208284031215620001b2578081fd5b8151620001bf816200024b565b9392505050565b600080600080600060a08688031215620001de578081fd5b8551620001eb816200024b565b6020870151909550620001fe816200024b565b604087015190945062ffffff8116811462000217578182fd5b60608701519093506200022a816200024b565b60808701519092506200023d816200024b565b809150509295509295909350565b6001600160a01b03811681146200026157600080fd5b50565b60805160601c60a05160601c612e97620002c86000396000818161028401528181610973015281816116740152611d240152600081816104070152818161140d015281816115b90152818161174b0152818161185401526119e60152612e976000f3fe6080604052600436106101775760003560e01c806378e97925116100cc578063b44a27221161007a578063b44a272214610502578063b66503cf14610522578063bf7989b914610542578063c45a015514610558578063d5a44f8614610578578063e70eb392146105bf578063ea9f5517146105df57600080fd5b806378e97925146103c957806379aa9db5146103df5780637b103999146103f557806399bcc05214610429578063a65b781e1461044b578063ac9650d81461046b578063b02c43d01461048b57600080fd5b80631be05289116101295780631be05289146102d35780632f745c59146102e95780633197cbb614610309578063403017ca1461031f5780634f6ccce71461035a57806350baa6221461037a57806370a082311461039c57600080fd5b80630520537f1461017c5780630700037d146101af5780630b9cc5fd146101dc5780630d5df7ba14610209578063150b7a021461023957806316f0115b1461027257806318160ddd146102be575b600080fd5b34801561018857600080fd5b5061019c6101973660046127d2565b6105ff565b6040519081526020015b60405180910390f35b3480156101bb57600080fd5b5061019c6101ca36600461262d565b600a6020526000908152604090205481565b3480156101e857600080fd5b506101fc6101f7366004612798565b610665565b6040516101a69190612b5b565b34801561021557600080fd5b50600154600254604080519283526001600160a01b039091166020830152016101a6565b34801561024557600080fd5b50610259610254366004612665565b610809565b6040516001600160e01b031990911681526020016101a6565b34801561027e57600080fd5b506102a67f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016101a6565b3480156102ca57600080fd5b50600e5461019c565b3480156102df57600080fd5b5061019c611c2081565b3480156102f557600080fd5b5061019c6103043660046126fe565b610e9e565b34801561031557600080fd5b5061019c60045481565b34801561032b57600080fd5b5061033f61033a3660046129e1565b610f42565b604080519384526020840192909252908201526060016101a6565b34801561036657600080fd5b5061019c6103753660046129b1565b610fcd565b34801561038657600080fd5b5061039a6103953660046129b1565b61106e565b005b3480156103a857600080fd5b5061019c6103b736600461262d565b600b6020526000908152604090205481565b3480156103d557600080fd5b5061019c60035481565b3480156103eb57600080fd5b5061019c60095481565b34801561040157600080fd5b506102a67f000000000000000000000000000000000000000000000000000000000000000081565b34801561043557600080fd5b5061019c61044436600461262d565b5060015490565b34801561045757600080fd5b506002546102a6906001600160a01b031681565b61047e610479366004612729565b611236565b6040516101a69190612ba1565b34801561049757600080fd5b506104d96104a63660046129b1565b6007602052600090815260409020546001600160a01b03811690600160a01b8104600290810b91600160b81b9004900b83565b604080516001600160a01b039094168452600292830b6020850152910b908201526060016101a6565b34801561050e57600080fd5b506006546102a6906001600160a01b031681565b34801561052e57600080fd5b5061039a61053d3660046126fe565b6113b0565b34801561054e57600080fd5b5061019c60015481565b34801561056457600080fd5b506005546102a6906001600160a01b031681565b34801561058457600080fd5b506105986105933660046129b1565b6116cb565b604080516001600160a01b0390931683526001600160801b039091166020830152016101a6565b3480156105cb57600080fd5b5061019c6105da3660046129e1565b611717565b3480156105eb57600080fd5b5061019c6105fa3660046129e1565b61172a565b60008060005b845181101561065d5761063f85828151811061063157634e487b7160e01b600052603260045260246000fd5b6020026020010151856119b0565b6106499083612cbb565b91508061065581612dec565b915050610605565b509392505050565b6060600082516001600160401b0381111561069057634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156106b9578160200160208202803683370190505b50905060005b83518110156108025760008482815181106106ea57634e487b7160e01b600052603260045260246000fd5b60209081029190910101516005546006549192506000918291829161071c916001600160a01b03908116911686611ac6565b509250925092506000836001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b15801561075e57600080fd5b505afa158015610772573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107969190612923565b50505050509150508060020b8360020b1280156107b857508160020b8160020b125b8787815181106107d857634e487b7160e01b600052603260045260246000fd5b602002602001019015159081151581525050505050505080806107fa90612dec565b9150506106bf565b5092915050565b6006546000906001600160a01b031633146108865760405162461bcd60e51b815260206004820152603260248201527f556e697377617056335374616b65723a3a6f6e45524337323152656365697665604482015271190e881b9bdd0818481d5b9a5d8cc81b999d60721b60648201526084015b60405180910390fd5b6005546006546000918291829182916108ac916001600160a01b0390811691168a611ac6565b935093509350935060405180606001604052808a6001600160a01b031681526020018460020b81526020018360020b815250600760008a815260200190815260200160002060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060208201518160000160146101000a81548162ffffff021916908360020b62ffffff16021790555060408201518160000160176101000a81548162ffffff021916908360020b62ffffff1602179055509050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b031614610a185760405162461bcd60e51b815260206004820152603d60248201527f556e697377617056335374616b65723a3a7374616b65546f6b656e3a20746f6b60448201527f656e20706f6f6c206973206e6f742074686520726967687420706f6f6c000000606482015260840161087d565b6000816001600160801b031611610a99576040805162461bcd60e51b81526020600482015260248101919091527f556e697377617056335374616b65723a3a7374616b65546f6b656e3a2063616e60448201527f6e6f74207374616b6520746f6b656e20776974682030206c6971756964697479606482015260840161087d565b806001600160801b031660096000828254610ab49190612cbb565b9091555060009050610acf6001600160801b0383168b61172a565b6040516351c403f960e11b8152600286810b600483015285900b60248201529091506000906001600160a01b0387169063a38807f29060440160606040518083038186803b158015610b2057600080fd5b505afa158015610b34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b58919061283b565b509150506001600160601b036001600160801b03831610610c87576040518060800160405280826001600160a01b031681526020016001600160601b0380168152602001836001600160801b03168152602001846001600160801b0316815250600860008c815260200190815260200160002060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060208201518160000160146101000a8154816001600160601b0302191690836001600160601b0316021790555060408201518160010160006101000a8154816001600160801b0302191690836001600160801b0316021790555060608201518160010160106101000a8154816001600160801b0302191690836001600160801b03160217905550905050610d98565b6040518060800160405280826001600160a01b03168152602001836001600160601b0316815260200160006001600160801b03168152602001846001600160801b0316815250600860008c815260200190815260200160002060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060208201518160000160146101000a8154816001600160601b0302191690836001600160601b0316021790555060408201518160010160006101000a8154816001600160801b0302191690836001600160801b0316021790555060608201518160010160106101000a8154816001600160801b0302191690836001600160801b031602179055509050505b610de08a600e80546000838152600f60205260408120829055600182018355919091527fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fd0155565b6001600160a01b038b166000908152600b6020908152604080832054600c835281842081855283528184208e90558d8452600d909252909120556001600160a01b038b166000908152600b60205260408120805460019290610e43908490612cbb565b90915550506040516001600160801b03841681528a907f4a1aff2ad1f7400721a859525efe44bd9dea253e1e02ba4161f2c77ed16fc0a39060200160405180910390a250630a85bd0160e11b9b9a5050505050505050505050565b6001600160a01b0382166000908152600b60205260408120548210610f195760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b606482015260840161087d565b506001600160a01b03919091166000908152600c60209081526040808320938352929052205490565b600554600654600091829182918291610f68916001600160a01b03908116911688611ac6565b93505050506064816014610f7c9190612d0d565b610f869190612cd3565b6001600160801b03169350610fa4816001600160801b03168661172a565b925082610fb985670de0b6b3a7640000612d62565b610fc39190612cf9565b9150509250925092565b6000610fd8600e5490565b821061103b5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b606482015260840161087d565b600e828154811061105c57634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050919050565b61107781611c1a565b60008181526008602052604081206001015460098054600160801b9092046001600160801b03169290916110ac908490612da9565b90915550506000818152600760205260409020546001600160a01b0316331461113d5760405162461bcd60e51b815260206004820152603d60248201527f556e697377617056335374616b65723a3a7769746864726177546f6b656e3a2060448201527f6f6e6c79206f776e65722063616e20776974686472617720746f6b656e000000606482015260840161087d565b600081815260076020908152604080832080546001600160d01b031916905560089091528120818155600101556111743382611e65565b61117d81611f01565b336000908152600b6020526040812080546001929061119d908490612da9565b909155505060405181907f85837b804496fa8a31cf9284d2c34c3276ca3d5369cfe705026f7bad0365c0f290600090a2600654604051632142170760e11b81526001600160a01b03909116906342842e0e9061120190309033908690600401612b37565b600060405180830381600087803b15801561121b57600080fd5b505af115801561122f573d6000803e3d6000fd5b5050505050565b6060816001600160401b0381111561125e57634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561129157816020015b606081526020019060019003908161127c5790505b50905060005b8281101561080257600080308686858181106112c357634e487b7160e01b600052603260045260246000fd5b90506020028101906112d59190612c15565b6040516112e3929190612b0b565b600060405180830381855af49150503d806000811461131e576040519150601f19603f3d011682016040523d82523d6000602084013e611323565b606091505b50915091508161136f5760448151101561133c57600080fd5b600481019050808060200190518101906113569190612894565b60405162461bcd60e51b815260040161087d9190612c02565b8084848151811061139057634e487b7160e01b600052603260045260246000fd5b6020026020010181905250505080806113a890612dec565b915050611297565b600260005414156114035760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161087d565b60026000819055507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633de00c366040518163ffffffff1660e01b815260040160206040518083038186803b15801561146457600080fd5b505afa158015611478573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061149c9190612649565b6001600160a01b0316826001600160a01b0316146115185760405162461bcd60e51b815260206004820152603360248201527f556e697377617056335374616b65723a3a637265617465496e63656e746976656044820152720e881bdb9b1e481b585a1848185b1b1bddd959606a1b606482015260840161087d565b6000811161158a5760405162461bcd60e51b815260206004820152603960248201527f556e697377617056335374616b65723a3a637265617465496e63656e746976656044820152783a20726577617264206d75737420626520706f73697469766560381b606482015260840161087d565b806001600082825461159c9190612cbb565b909155506115ae9050611c2042612cbb565b6004819055506116507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633de00c366040518163ffffffff1660e01b815260040160206040518083038186803b15801561161057600080fd5b505afa158015611624573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116489190612649565b333084611fda565b60035460045460408051928352602083019190915281018290526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016907fd7a440eccc1b2ae97683e4d1cd3e4e1f17ec4eb738ff723eff7a664a33c417989060600160405180910390a250506001600055565b600081815260086020526040902080546001600160a01b038116916001600160601b03600160a01b9092048216918214156117115760018101546001600160801b031691505b50915091565b600061172383836119b0565b9392505050565b600080606461173a856014612d62565b6117449190612cf9565b90506000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d7b96d4e6040518163ffffffff1660e01b815260040160206040518083038186803b1580156117a257600080fd5b505afa1580156117b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117da9190612649565b6001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561181257600080fd5b505afa158015611826573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061184a91906129c9565b90508015611993577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635ebaf1db6040518163ffffffff1660e01b815260040160206040518083038186803b1580156118ab57600080fd5b505afa1580156118bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118e39190612649565b6040516370a0823160e01b81526001600160a01b03878116600483015291909116906370a082319060240160206040518083038186803b15801561192657600080fd5b505afa15801561193a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061195e91906129c9565b9150606481836009546119719190612d62565b61197b9190612cf9565b611986906050612d62565b6119909190612cf9565b91505b6119a66119a08385612cbb565b87612069565b9695505050505050565b60006119bb83611c1a565b336000908152600a602052604081208054918291906119da8380612da9565b92505081905550611a7c7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633de00c366040518163ffffffff1660e01b815260040160206040518083038186803b158015611a3d57600080fd5b505afa158015611a51573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a759190612649565b848361207f565b826001600160a01b03167f106f923f993c2149d49b4255ff723acafa1f2d94393f561d3eda32ae348f724182604051611ab791815260200190565b60405180910390a29392505050565b6000806000806000806000886001600160a01b03166399fbab88896040518263ffffffff1660e01b8152600401611aff91815260200190565b6101806040518083038186803b158015611b1857600080fd5b505afa158015611b2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b509190612a05565b5050604051630b4c774160e11b8152949f50929d50909b509499509297509095506001600160a01b038f169450631698ee829350611bbc9250879150869086906004016001600160a01b03938416815291909216602082015262ffffff91909116604082015260600190565b60206040518083038186803b158015611bd457600080fd5b505afa158015611be8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c0c9190612649565b965050505093509350935093565b6000818152600760209081526040808320815160608101835290546001600160a01b0381168252600160a01b8104600290810b810b810b94830194909452600160b81b9004830b830b90920b908201529080611c75846116cb565b91509150806001600160801b031660001415611cef5760405162461bcd60e51b815260206004820152603360248201527f556e697377617056335374616b65723a3a756e7374616b65546f6b656e3a20736044820152721d185ad948191bd95cc81b9bdd08195e1a5cdd606a1b606482015260840161087d565b602083015160408085015190516351c403f960e11b8152600292830b6004820152910b60248201526000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a38807f29060440160606040518083038186803b158015611d6657600080fd5b505afa158015611d7a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d9e919061283b565b50915050600080611dd0600154600260009054906101000a90046001600160a01b0316600354600454888a894261210c565b600280549294509092508291600090611df39084906001600160a01b0316612c90565b92506101000a8154816001600160a01b0302191690836001600160a01b031602179055508160016000828254611e299190612da9565b909155505085516001600160a01b03166000908152600a602052604081208054849290611e57908490612cbb565b909155505050505050505050565b6001600160a01b0382166000908152600b6020908152604080832054848452600d90925290912054808214611ece576001600160a01b0384166000908152600c602090815260408083208584528252808320548484528184208190558352600d90915290208190555b506000918252600d602090815260408084208490556001600160a01b039094168352600c81528383209183525290812055565b600e54600090611f1390600190612da9565b6000838152600f6020526040812054600e8054939450909284908110611f4957634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905080600e8381548110611f7857634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910192909255828152600f9091526040808220849055858252812055600e805480611fbe57634e487b7160e01b600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b6001600160a01b0384163b6120575760405162461bcd60e51b815260206004820152603e60248201527f5472616e7366657248656c706572457874656e6465643a3a736166655472616e60448201527f7366657246726f6d3a2063616c6c20746f206e6f6e2d636f6e74726163740000606482015260840161087d565b612063848484846121a1565b50505050565b60008183106120785781611723565b5090919050565b6001600160a01b0383163b6120fc5760405162461bcd60e51b815260206004820152603a60248201527f5472616e7366657248656c706572457874656e6465643a3a736166655472616e60448201527f736665723a2063616c6c20746f206e6f6e2d636f6e7472616374000000000000606482015260840161087d565b6121078383836122af565b505050565b6000808783101561212d57634e487b7160e01b600052600160045260246000fd5b6001600160801b0386166121418686612d81565b61214b9190612d3c565b90506000896001600160a01b031660808a6121668b886123a8565b6121709190612da9565b61217b92911b612da9565b90506121918b836001600160a01b0316836123b8565b9250509850989650505050505050565b600080856001600160a01b03166323b872dd60e01b8686866040516024016121cb93929190612b37565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199094169390931790925290516122099190612b1b565b6000604051808303816000865af19150503d8060008114612246576040519150601f19603f3d011682016040523d82523d6000602084013e61224b565b606091505b50915091508180156122755750805115806122755750808060200190518101906122759190612821565b6122a75760405162461bcd60e51b815260206004820152600360248201526229aa2360e91b604482015260640161087d565b505050505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b179052915160009283929087169161230b9190612b1b565b6000604051808303816000865af19150503d8060008114612348576040519150601f19603f3d011682016040523d82523d6000602084013e61234d565b606091505b50915091508180156123775750805115806123775750808060200190518101906123779190612821565b61122f5760405162461bcd60e51b815260206004820152600260248201526114d560f21b604482015260640161087d565b6000818310156120785781611723565b6000808060001985870985870292508281108382030391505080600014156123f257600084116123e757600080fd5b508290049050611723565b8084116123fe57600080fd5b60008486880980840393811190920391905060008561241f81600019612da9565b61242a906001612cbb565b1695869004959384900493600081900304600101905061244a8184612d62565b90931792600061245b876003612d62565b600218905061246a8188612d62565b612475906002612da9565b61247f9082612d62565b905061248b8188612d62565b612496906002612da9565b6124a09082612d62565b90506124ac8188612d62565b6124b7906002612da9565b6124c19082612d62565b90506124cd8188612d62565b6124d8906002612da9565b6124e29082612d62565b90506124ee8188612d62565b6124f9906002612da9565b6125039082612d62565b905061250f8188612d62565b61251a906002612da9565b6125249082612d62565b90506125308186612d62565b9998505050505050505050565b805161254881612e49565b919050565b600082601f83011261255d578081fd5b813560206001600160401b0382111561257857612578612e33565b8160051b612587828201612c60565b8381528281019086840183880185018910156125a1578687fd5b8693505b858410156125c35780358352600193909301929184019184016125a5565b50979650505050505050565b8051801515811461254857600080fd5b8051600281900b811461254857600080fd5b80516001600160801b038116811461254857600080fd5b805161ffff8116811461254857600080fd5b805162ffffff8116811461254857600080fd5b60006020828403121561263e578081fd5b813561172381612e49565b60006020828403121561265a578081fd5b815161172381612e49565b60008060008060006080868803121561267c578081fd5b853561268781612e49565b9450602086013561269781612e49565b93506040860135925060608601356001600160401b03808211156126b9578283fd5b818801915088601f8301126126cc578283fd5b8135818111156126da578384fd5b8960208285010111156126eb578384fd5b9699959850939650602001949392505050565b60008060408385031215612710578182fd5b823561271b81612e49565b946020939093013593505050565b6000806020838503121561273b578182fd5b82356001600160401b0380821115612751578384fd5b818501915085601f830112612764578384fd5b813581811115612772578485fd5b8660208260051b8501011115612786578485fd5b60209290920196919550909350505050565b6000602082840312156127a9578081fd5b81356001600160401b038111156127be578182fd5b6127ca8482850161254d565b949350505050565b600080604083850312156127e4578182fd5b82356001600160401b038111156127f9578283fd5b6128058582860161254d565b925050602083013561281681612e49565b809150509250929050565b600060208284031215612832578081fd5b611723826125cf565b60008060006060848603121561284f578081fd5b83518060060b811461285f578182fd5b602085015190935061287081612e49565b604085015190925063ffffffff81168114612889578182fd5b809150509250925092565b6000602082840312156128a5578081fd5b81516001600160401b03808211156128bb578283fd5b818401915084601f8301126128ce578283fd5b8151818111156128e0576128e0612e33565b6128f3601f8201601f1916602001612c60565b9150808252856020828501011115612909578384fd5b61291a816020840160208601612dc0565b50949350505050565b600080600080600080600060e0888a03121561293d578485fd5b875161294881612e49565b9650612956602089016125df565b955061296460408901612608565b945061297260608901612608565b935061298060808901612608565b925060a088015160ff81168114612995578283fd5b91506129a360c089016125cf565b905092959891949750929550565b6000602082840312156129c2578081fd5b5035919050565b6000602082840312156129da578081fd5b5051919050565b600080604083850312156129f3578182fd5b82359150602083013561281681612e49565b6000806000806000806000806000806000806101808d8f031215612a27578586fd5b8c516001600160601b0381168114612a3d578687fd5b9b50612a4b60208e0161253d565b9a50612a5960408e0161253d565b9950612a6760608e0161253d565b9850612a7560808e0161261a565b9750612a8360a08e016125df565b9650612a9160c08e016125df565b9550612a9f60e08e016125f1565b94506101008d015193506101208d01519250612abe6101408e016125f1565b9150612acd6101608e016125f1565b90509295989b509295989b509295989b565b60008151808452612af7816020860160208601612dc0565b601f01601f19169290920160200192915050565b8183823760009101908152919050565b60008251612b2d818460208701612dc0565b9190910192915050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6020808252825182820181905260009190848201906040850190845b81811015612b95578351151583529284019291840191600101612b77565b50909695505050505050565b6000602080830181845280855180835260408601915060408160051b8701019250838701855b82811015612bf557603f19888603018452612be3858351612adf565b94509285019290850190600101612bc7565b5092979650505050505050565b6020815260006117236020830184612adf565b6000808335601e19843603018112612c2b578283fd5b8301803591506001600160401b03821115612c44578283fd5b602001915036819003821315612c5957600080fd5b9250929050565b604051601f8201601f191681016001600160401b0381118282101715612c8857612c88612e33565b604052919050565b60006001600160a01b03828116848216808303821115612cb257612cb2612e07565b01949350505050565b60008219821115612cce57612cce612e07565b500190565b60006001600160801b0383811680612ced57612ced612e1d565b92169190910492915050565b600082612d0857612d08612e1d565b500490565b60006001600160801b0382811684821681151582840482111615612d3357612d33612e07565b02949350505050565b60006001600160a01b0382811684821681151582840482111615612d3357612d33612e07565b6000816000190483118215151615612d7c57612d7c612e07565b500290565b60006001600160a01b0383811690831681811015612da157612da1612e07565b039392505050565b600082821015612dbb57612dbb612e07565b500390565b60005b83811015612ddb578181015183820152602001612dc3565b838111156120635750506000910152565b6000600019821415612e0057612e00612e07565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114612e5e57600080fd5b5056fea26469706673582212203a785225643ad822bdaf48a9e005169a53a00a21c524ac9fc4dfbdaba8eb610164736f6c634300080400330000000000000000000000008cc0f052fff7ead7f2edcccac895502e884a8a71000000000000000000000000b4d930279552397bba2ee473229f89ec245bc36500000000000000000000000000000000000000000000000000000000000027100000000000000000000000002684861ba9dada685a11c4e9e5aed8630f08afe0000000000000000000000000c36442b4a4522e871399cd717abdd847ab11fe88

Deployed Bytecode

0x6080604052600436106101775760003560e01c806378e97925116100cc578063b44a27221161007a578063b44a272214610502578063b66503cf14610522578063bf7989b914610542578063c45a015514610558578063d5a44f8614610578578063e70eb392146105bf578063ea9f5517146105df57600080fd5b806378e97925146103c957806379aa9db5146103df5780637b103999146103f557806399bcc05214610429578063a65b781e1461044b578063ac9650d81461046b578063b02c43d01461048b57600080fd5b80631be05289116101295780631be05289146102d35780632f745c59146102e95780633197cbb614610309578063403017ca1461031f5780634f6ccce71461035a57806350baa6221461037a57806370a082311461039c57600080fd5b80630520537f1461017c5780630700037d146101af5780630b9cc5fd146101dc5780630d5df7ba14610209578063150b7a021461023957806316f0115b1461027257806318160ddd146102be575b600080fd5b34801561018857600080fd5b5061019c6101973660046127d2565b6105ff565b6040519081526020015b60405180910390f35b3480156101bb57600080fd5b5061019c6101ca36600461262d565b600a6020526000908152604090205481565b3480156101e857600080fd5b506101fc6101f7366004612798565b610665565b6040516101a69190612b5b565b34801561021557600080fd5b50600154600254604080519283526001600160a01b039091166020830152016101a6565b34801561024557600080fd5b50610259610254366004612665565b610809565b6040516001600160e01b031990911681526020016101a6565b34801561027e57600080fd5b506102a67f000000000000000000000000c5ee69662e7ef79e503be9d54c237d5aafac305d81565b6040516001600160a01b0390911681526020016101a6565b3480156102ca57600080fd5b50600e5461019c565b3480156102df57600080fd5b5061019c611c2081565b3480156102f557600080fd5b5061019c6103043660046126fe565b610e9e565b34801561031557600080fd5b5061019c60045481565b34801561032b57600080fd5b5061033f61033a3660046129e1565b610f42565b604080519384526020840192909252908201526060016101a6565b34801561036657600080fd5b5061019c6103753660046129b1565b610fcd565b34801561038657600080fd5b5061039a6103953660046129b1565b61106e565b005b3480156103a857600080fd5b5061019c6103b736600461262d565b600b6020526000908152604090205481565b3480156103d557600080fd5b5061019c60035481565b3480156103eb57600080fd5b5061019c60095481565b34801561040157600080fd5b506102a67f0000000000000000000000002684861ba9dada685a11c4e9e5aed8630f08afe081565b34801561043557600080fd5b5061019c61044436600461262d565b5060015490565b34801561045757600080fd5b506002546102a6906001600160a01b031681565b61047e610479366004612729565b611236565b6040516101a69190612ba1565b34801561049757600080fd5b506104d96104a63660046129b1565b6007602052600090815260409020546001600160a01b03811690600160a01b8104600290810b91600160b81b9004900b83565b604080516001600160a01b039094168452600292830b6020850152910b908201526060016101a6565b34801561050e57600080fd5b506006546102a6906001600160a01b031681565b34801561052e57600080fd5b5061039a61053d3660046126fe565b6113b0565b34801561054e57600080fd5b5061019c60015481565b34801561056457600080fd5b506005546102a6906001600160a01b031681565b34801561058457600080fd5b506105986105933660046129b1565b6116cb565b604080516001600160a01b0390931683526001600160801b039091166020830152016101a6565b3480156105cb57600080fd5b5061019c6105da3660046129e1565b611717565b3480156105eb57600080fd5b5061019c6105fa3660046129e1565b61172a565b60008060005b845181101561065d5761063f85828151811061063157634e487b7160e01b600052603260045260246000fd5b6020026020010151856119b0565b6106499083612cbb565b91508061065581612dec565b915050610605565b509392505050565b6060600082516001600160401b0381111561069057634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156106b9578160200160208202803683370190505b50905060005b83518110156108025760008482815181106106ea57634e487b7160e01b600052603260045260246000fd5b60209081029190910101516005546006549192506000918291829161071c916001600160a01b03908116911686611ac6565b509250925092506000836001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b15801561075e57600080fd5b505afa158015610772573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107969190612923565b50505050509150508060020b8360020b1280156107b857508160020b8160020b125b8787815181106107d857634e487b7160e01b600052603260045260246000fd5b602002602001019015159081151581525050505050505080806107fa90612dec565b9150506106bf565b5092915050565b6006546000906001600160a01b031633146108865760405162461bcd60e51b815260206004820152603260248201527f556e697377617056335374616b65723a3a6f6e45524337323152656365697665604482015271190e881b9bdd0818481d5b9a5d8cc81b999d60721b60648201526084015b60405180910390fd5b6005546006546000918291829182916108ac916001600160a01b0390811691168a611ac6565b935093509350935060405180606001604052808a6001600160a01b031681526020018460020b81526020018360020b815250600760008a815260200190815260200160002060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060208201518160000160146101000a81548162ffffff021916908360020b62ffffff16021790555060408201518160000160176101000a81548162ffffff021916908360020b62ffffff1602179055509050507f000000000000000000000000c5ee69662e7ef79e503be9d54c237d5aafac305d6001600160a01b0316846001600160a01b031614610a185760405162461bcd60e51b815260206004820152603d60248201527f556e697377617056335374616b65723a3a7374616b65546f6b656e3a20746f6b60448201527f656e20706f6f6c206973206e6f742074686520726967687420706f6f6c000000606482015260840161087d565b6000816001600160801b031611610a99576040805162461bcd60e51b81526020600482015260248101919091527f556e697377617056335374616b65723a3a7374616b65546f6b656e3a2063616e60448201527f6e6f74207374616b6520746f6b656e20776974682030206c6971756964697479606482015260840161087d565b806001600160801b031660096000828254610ab49190612cbb565b9091555060009050610acf6001600160801b0383168b61172a565b6040516351c403f960e11b8152600286810b600483015285900b60248201529091506000906001600160a01b0387169063a38807f29060440160606040518083038186803b158015610b2057600080fd5b505afa158015610b34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b58919061283b565b509150506001600160601b036001600160801b03831610610c87576040518060800160405280826001600160a01b031681526020016001600160601b0380168152602001836001600160801b03168152602001846001600160801b0316815250600860008c815260200190815260200160002060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060208201518160000160146101000a8154816001600160601b0302191690836001600160601b0316021790555060408201518160010160006101000a8154816001600160801b0302191690836001600160801b0316021790555060608201518160010160106101000a8154816001600160801b0302191690836001600160801b03160217905550905050610d98565b6040518060800160405280826001600160a01b03168152602001836001600160601b0316815260200160006001600160801b03168152602001846001600160801b0316815250600860008c815260200190815260200160002060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060208201518160000160146101000a8154816001600160601b0302191690836001600160601b0316021790555060408201518160010160006101000a8154816001600160801b0302191690836001600160801b0316021790555060608201518160010160106101000a8154816001600160801b0302191690836001600160801b031602179055509050505b610de08a600e80546000838152600f60205260408120829055600182018355919091527fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fd0155565b6001600160a01b038b166000908152600b6020908152604080832054600c835281842081855283528184208e90558d8452600d909252909120556001600160a01b038b166000908152600b60205260408120805460019290610e43908490612cbb565b90915550506040516001600160801b03841681528a907f4a1aff2ad1f7400721a859525efe44bd9dea253e1e02ba4161f2c77ed16fc0a39060200160405180910390a250630a85bd0160e11b9b9a5050505050505050505050565b6001600160a01b0382166000908152600b60205260408120548210610f195760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b606482015260840161087d565b506001600160a01b03919091166000908152600c60209081526040808320938352929052205490565b600554600654600091829182918291610f68916001600160a01b03908116911688611ac6565b93505050506064816014610f7c9190612d0d565b610f869190612cd3565b6001600160801b03169350610fa4816001600160801b03168661172a565b925082610fb985670de0b6b3a7640000612d62565b610fc39190612cf9565b9150509250925092565b6000610fd8600e5490565b821061103b5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b606482015260840161087d565b600e828154811061105c57634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050919050565b61107781611c1a565b60008181526008602052604081206001015460098054600160801b9092046001600160801b03169290916110ac908490612da9565b90915550506000818152600760205260409020546001600160a01b0316331461113d5760405162461bcd60e51b815260206004820152603d60248201527f556e697377617056335374616b65723a3a7769746864726177546f6b656e3a2060448201527f6f6e6c79206f776e65722063616e20776974686472617720746f6b656e000000606482015260840161087d565b600081815260076020908152604080832080546001600160d01b031916905560089091528120818155600101556111743382611e65565b61117d81611f01565b336000908152600b6020526040812080546001929061119d908490612da9565b909155505060405181907f85837b804496fa8a31cf9284d2c34c3276ca3d5369cfe705026f7bad0365c0f290600090a2600654604051632142170760e11b81526001600160a01b03909116906342842e0e9061120190309033908690600401612b37565b600060405180830381600087803b15801561121b57600080fd5b505af115801561122f573d6000803e3d6000fd5b5050505050565b6060816001600160401b0381111561125e57634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561129157816020015b606081526020019060019003908161127c5790505b50905060005b8281101561080257600080308686858181106112c357634e487b7160e01b600052603260045260246000fd5b90506020028101906112d59190612c15565b6040516112e3929190612b0b565b600060405180830381855af49150503d806000811461131e576040519150601f19603f3d011682016040523d82523d6000602084013e611323565b606091505b50915091508161136f5760448151101561133c57600080fd5b600481019050808060200190518101906113569190612894565b60405162461bcd60e51b815260040161087d9190612c02565b8084848151811061139057634e487b7160e01b600052603260045260246000fd5b6020026020010181905250505080806113a890612dec565b915050611297565b600260005414156114035760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161087d565b60026000819055507f0000000000000000000000002684861ba9dada685a11c4e9e5aed8630f08afe06001600160a01b0316633de00c366040518163ffffffff1660e01b815260040160206040518083038186803b15801561146457600080fd5b505afa158015611478573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061149c9190612649565b6001600160a01b0316826001600160a01b0316146115185760405162461bcd60e51b815260206004820152603360248201527f556e697377617056335374616b65723a3a637265617465496e63656e746976656044820152720e881bdb9b1e481b585a1848185b1b1bddd959606a1b606482015260840161087d565b6000811161158a5760405162461bcd60e51b815260206004820152603960248201527f556e697377617056335374616b65723a3a637265617465496e63656e746976656044820152783a20726577617264206d75737420626520706f73697469766560381b606482015260840161087d565b806001600082825461159c9190612cbb565b909155506115ae9050611c2042612cbb565b6004819055506116507f0000000000000000000000002684861ba9dada685a11c4e9e5aed8630f08afe06001600160a01b0316633de00c366040518163ffffffff1660e01b815260040160206040518083038186803b15801561161057600080fd5b505afa158015611624573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116489190612649565b333084611fda565b60035460045460408051928352602083019190915281018290526001600160a01b037f000000000000000000000000c5ee69662e7ef79e503be9d54c237d5aafac305d16907fd7a440eccc1b2ae97683e4d1cd3e4e1f17ec4eb738ff723eff7a664a33c417989060600160405180910390a250506001600055565b600081815260086020526040902080546001600160a01b038116916001600160601b03600160a01b9092048216918214156117115760018101546001600160801b031691505b50915091565b600061172383836119b0565b9392505050565b600080606461173a856014612d62565b6117449190612cf9565b90506000807f0000000000000000000000002684861ba9dada685a11c4e9e5aed8630f08afe06001600160a01b031663d7b96d4e6040518163ffffffff1660e01b815260040160206040518083038186803b1580156117a257600080fd5b505afa1580156117b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117da9190612649565b6001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561181257600080fd5b505afa158015611826573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061184a91906129c9565b90508015611993577f0000000000000000000000002684861ba9dada685a11c4e9e5aed8630f08afe06001600160a01b0316635ebaf1db6040518163ffffffff1660e01b815260040160206040518083038186803b1580156118ab57600080fd5b505afa1580156118bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118e39190612649565b6040516370a0823160e01b81526001600160a01b03878116600483015291909116906370a082319060240160206040518083038186803b15801561192657600080fd5b505afa15801561193a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061195e91906129c9565b9150606481836009546119719190612d62565b61197b9190612cf9565b611986906050612d62565b6119909190612cf9565b91505b6119a66119a08385612cbb565b87612069565b9695505050505050565b60006119bb83611c1a565b336000908152600a602052604081208054918291906119da8380612da9565b92505081905550611a7c7f0000000000000000000000002684861ba9dada685a11c4e9e5aed8630f08afe06001600160a01b0316633de00c366040518163ffffffff1660e01b815260040160206040518083038186803b158015611a3d57600080fd5b505afa158015611a51573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a759190612649565b848361207f565b826001600160a01b03167f106f923f993c2149d49b4255ff723acafa1f2d94393f561d3eda32ae348f724182604051611ab791815260200190565b60405180910390a29392505050565b6000806000806000806000886001600160a01b03166399fbab88896040518263ffffffff1660e01b8152600401611aff91815260200190565b6101806040518083038186803b158015611b1857600080fd5b505afa158015611b2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b509190612a05565b5050604051630b4c774160e11b8152949f50929d50909b509499509297509095506001600160a01b038f169450631698ee829350611bbc9250879150869086906004016001600160a01b03938416815291909216602082015262ffffff91909116604082015260600190565b60206040518083038186803b158015611bd457600080fd5b505afa158015611be8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c0c9190612649565b965050505093509350935093565b6000818152600760209081526040808320815160608101835290546001600160a01b0381168252600160a01b8104600290810b810b810b94830194909452600160b81b9004830b830b90920b908201529080611c75846116cb565b91509150806001600160801b031660001415611cef5760405162461bcd60e51b815260206004820152603360248201527f556e697377617056335374616b65723a3a756e7374616b65546f6b656e3a20736044820152721d185ad948191bd95cc81b9bdd08195e1a5cdd606a1b606482015260840161087d565b602083015160408085015190516351c403f960e11b8152600292830b6004820152910b60248201526000906001600160a01b037f000000000000000000000000c5ee69662e7ef79e503be9d54c237d5aafac305d169063a38807f29060440160606040518083038186803b158015611d6657600080fd5b505afa158015611d7a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d9e919061283b565b50915050600080611dd0600154600260009054906101000a90046001600160a01b0316600354600454888a894261210c565b600280549294509092508291600090611df39084906001600160a01b0316612c90565b92506101000a8154816001600160a01b0302191690836001600160a01b031602179055508160016000828254611e299190612da9565b909155505085516001600160a01b03166000908152600a602052604081208054849290611e57908490612cbb565b909155505050505050505050565b6001600160a01b0382166000908152600b6020908152604080832054848452600d90925290912054808214611ece576001600160a01b0384166000908152600c602090815260408083208584528252808320548484528184208190558352600d90915290208190555b506000918252600d602090815260408084208490556001600160a01b039094168352600c81528383209183525290812055565b600e54600090611f1390600190612da9565b6000838152600f6020526040812054600e8054939450909284908110611f4957634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905080600e8381548110611f7857634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910192909255828152600f9091526040808220849055858252812055600e805480611fbe57634e487b7160e01b600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b6001600160a01b0384163b6120575760405162461bcd60e51b815260206004820152603e60248201527f5472616e7366657248656c706572457874656e6465643a3a736166655472616e60448201527f7366657246726f6d3a2063616c6c20746f206e6f6e2d636f6e74726163740000606482015260840161087d565b612063848484846121a1565b50505050565b60008183106120785781611723565b5090919050565b6001600160a01b0383163b6120fc5760405162461bcd60e51b815260206004820152603a60248201527f5472616e7366657248656c706572457874656e6465643a3a736166655472616e60448201527f736665723a2063616c6c20746f206e6f6e2d636f6e7472616374000000000000606482015260840161087d565b6121078383836122af565b505050565b6000808783101561212d57634e487b7160e01b600052600160045260246000fd5b6001600160801b0386166121418686612d81565b61214b9190612d3c565b90506000896001600160a01b031660808a6121668b886123a8565b6121709190612da9565b61217b92911b612da9565b90506121918b836001600160a01b0316836123b8565b9250509850989650505050505050565b600080856001600160a01b03166323b872dd60e01b8686866040516024016121cb93929190612b37565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199094169390931790925290516122099190612b1b565b6000604051808303816000865af19150503d8060008114612246576040519150601f19603f3d011682016040523d82523d6000602084013e61224b565b606091505b50915091508180156122755750805115806122755750808060200190518101906122759190612821565b6122a75760405162461bcd60e51b815260206004820152600360248201526229aa2360e91b604482015260640161087d565b505050505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b179052915160009283929087169161230b9190612b1b565b6000604051808303816000865af19150503d8060008114612348576040519150601f19603f3d011682016040523d82523d6000602084013e61234d565b606091505b50915091508180156123775750805115806123775750808060200190518101906123779190612821565b61122f5760405162461bcd60e51b815260206004820152600260248201526114d560f21b604482015260640161087d565b6000818310156120785781611723565b6000808060001985870985870292508281108382030391505080600014156123f257600084116123e757600080fd5b508290049050611723565b8084116123fe57600080fd5b60008486880980840393811190920391905060008561241f81600019612da9565b61242a906001612cbb565b1695869004959384900493600081900304600101905061244a8184612d62565b90931792600061245b876003612d62565b600218905061246a8188612d62565b612475906002612da9565b61247f9082612d62565b905061248b8188612d62565b612496906002612da9565b6124a09082612d62565b90506124ac8188612d62565b6124b7906002612da9565b6124c19082612d62565b90506124cd8188612d62565b6124d8906002612da9565b6124e29082612d62565b90506124ee8188612d62565b6124f9906002612da9565b6125039082612d62565b905061250f8188612d62565b61251a906002612da9565b6125249082612d62565b90506125308186612d62565b9998505050505050505050565b805161254881612e49565b919050565b600082601f83011261255d578081fd5b813560206001600160401b0382111561257857612578612e33565b8160051b612587828201612c60565b8381528281019086840183880185018910156125a1578687fd5b8693505b858410156125c35780358352600193909301929184019184016125a5565b50979650505050505050565b8051801515811461254857600080fd5b8051600281900b811461254857600080fd5b80516001600160801b038116811461254857600080fd5b805161ffff8116811461254857600080fd5b805162ffffff8116811461254857600080fd5b60006020828403121561263e578081fd5b813561172381612e49565b60006020828403121561265a578081fd5b815161172381612e49565b60008060008060006080868803121561267c578081fd5b853561268781612e49565b9450602086013561269781612e49565b93506040860135925060608601356001600160401b03808211156126b9578283fd5b818801915088601f8301126126cc578283fd5b8135818111156126da578384fd5b8960208285010111156126eb578384fd5b9699959850939650602001949392505050565b60008060408385031215612710578182fd5b823561271b81612e49565b946020939093013593505050565b6000806020838503121561273b578182fd5b82356001600160401b0380821115612751578384fd5b818501915085601f830112612764578384fd5b813581811115612772578485fd5b8660208260051b8501011115612786578485fd5b60209290920196919550909350505050565b6000602082840312156127a9578081fd5b81356001600160401b038111156127be578182fd5b6127ca8482850161254d565b949350505050565b600080604083850312156127e4578182fd5b82356001600160401b038111156127f9578283fd5b6128058582860161254d565b925050602083013561281681612e49565b809150509250929050565b600060208284031215612832578081fd5b611723826125cf565b60008060006060848603121561284f578081fd5b83518060060b811461285f578182fd5b602085015190935061287081612e49565b604085015190925063ffffffff81168114612889578182fd5b809150509250925092565b6000602082840312156128a5578081fd5b81516001600160401b03808211156128bb578283fd5b818401915084601f8301126128ce578283fd5b8151818111156128e0576128e0612e33565b6128f3601f8201601f1916602001612c60565b9150808252856020828501011115612909578384fd5b61291a816020840160208601612dc0565b50949350505050565b600080600080600080600060e0888a03121561293d578485fd5b875161294881612e49565b9650612956602089016125df565b955061296460408901612608565b945061297260608901612608565b935061298060808901612608565b925060a088015160ff81168114612995578283fd5b91506129a360c089016125cf565b905092959891949750929550565b6000602082840312156129c2578081fd5b5035919050565b6000602082840312156129da578081fd5b5051919050565b600080604083850312156129f3578182fd5b82359150602083013561281681612e49565b6000806000806000806000806000806000806101808d8f031215612a27578586fd5b8c516001600160601b0381168114612a3d578687fd5b9b50612a4b60208e0161253d565b9a50612a5960408e0161253d565b9950612a6760608e0161253d565b9850612a7560808e0161261a565b9750612a8360a08e016125df565b9650612a9160c08e016125df565b9550612a9f60e08e016125f1565b94506101008d015193506101208d01519250612abe6101408e016125f1565b9150612acd6101608e016125f1565b90509295989b509295989b509295989b565b60008151808452612af7816020860160208601612dc0565b601f01601f19169290920160200192915050565b8183823760009101908152919050565b60008251612b2d818460208701612dc0565b9190910192915050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6020808252825182820181905260009190848201906040850190845b81811015612b95578351151583529284019291840191600101612b77565b50909695505050505050565b6000602080830181845280855180835260408601915060408160051b8701019250838701855b82811015612bf557603f19888603018452612be3858351612adf565b94509285019290850190600101612bc7565b5092979650505050505050565b6020815260006117236020830184612adf565b6000808335601e19843603018112612c2b578283fd5b8301803591506001600160401b03821115612c44578283fd5b602001915036819003821315612c5957600080fd5b9250929050565b604051601f8201601f191681016001600160401b0381118282101715612c8857612c88612e33565b604052919050565b60006001600160a01b03828116848216808303821115612cb257612cb2612e07565b01949350505050565b60008219821115612cce57612cce612e07565b500190565b60006001600160801b0383811680612ced57612ced612e1d565b92169190910492915050565b600082612d0857612d08612e1d565b500490565b60006001600160801b0382811684821681151582840482111615612d3357612d33612e07565b02949350505050565b60006001600160a01b0382811684821681151582840482111615612d3357612d33612e07565b6000816000190483118215151615612d7c57612d7c612e07565b500290565b60006001600160a01b0383811690831681811015612da157612da1612e07565b039392505050565b600082821015612dbb57612dbb612e07565b500390565b60005b83811015612ddb578181015183820152602001612dc3565b838111156120635750506000910152565b6000600019821415612e0057612e00612e07565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114612e5e57600080fd5b5056fea26469706673582212203a785225643ad822bdaf48a9e005169a53a00a21c524ac9fc4dfbdaba8eb610164736f6c63430008040033

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

0000000000000000000000008cc0f052fff7ead7f2edcccac895502e884a8a71000000000000000000000000b4d930279552397bba2ee473229f89ec245bc36500000000000000000000000000000000000000000000000000000000000027100000000000000000000000002684861ba9dada685a11c4e9e5aed8630f08afe0000000000000000000000000c36442b4a4522e871399cd717abdd847ab11fe88

-----Decoded View---------------
Arg [0] : token0 (address): 0x8CC0F052fff7eaD7f2EdCCcaC895502E884a8a71
Arg [1] : token1 (address): 0xB4d930279552397bbA2ee473229f89Ec245bc365
Arg [2] : fee (uint24): 10000
Arg [3] : _registry (address): 0x2684861Ba9dadA685a11C4e9E5aED8630f08afe0
Arg [4] : _nonfungiblePositionManager (address): 0xC36442b4a4522E871399CD717aBDD847Ab11FE88

-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 0000000000000000000000008cc0f052fff7ead7f2edcccac895502e884a8a71
Arg [1] : 000000000000000000000000b4d930279552397bba2ee473229f89ec245bc365
Arg [2] : 0000000000000000000000000000000000000000000000000000000000002710
Arg [3] : 0000000000000000000000002684861ba9dada685a11c4e9e5aed8630f08afe0
Arg [4] : 000000000000000000000000c36442b4a4522e871399cd717abdd847ab11fe88


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  ]

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.