FRAX Price: $1.04 (+7.04%)

Contract

0x38E0437FA71818BFb1cE1c97E05134374a958455

Overview

FRAX Balance | FXTL Balance

0 FRAX | 0 FXTL

FRAX Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To

There are no matching entries

Please try again later

View more zero value Internal Transactions in Advanced View mode

Advanced mode:

Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Lens

Compiler Version
v0.8.23+commit.f704f362

Optimization Enabled:
Yes with 800 runs

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

import "./interfaces/IPairFactory.sol";
import "./interfaces/IVoter.sol";
import "./interfaces/IVotingEscrow.sol";
import "./interfaces/IMinter.sol";
import "./interfaces/IPair.sol";
import "./interfaces/IFeeDistributor.sol";
import "./interfaces/IGauge.sol";
import "contracts/interfaces/IRewardsDistributor.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

import "contracts/v2-staking/interfaces/INonfungiblePositionManager.sol";
import "contracts/v2-staking/interfaces/IGaugeV2.sol";
import "contracts/v2-staking/libraries/PoolAddress.sol";

contract Lens is Initializable {
    IVoter public voter;
    IVotingEscrow public ve;
    IMinter public minter;

    address public router; // router address

    address public v2Factory;
    address public v2Nfp;
    address public v2Router;
    address public v2QuoterV2;
    address public v2PairFlash;

    struct Pool {
        address id;
        string symbol;
        bool stable;
        address token0;
        address token1;
        address gauge;
        address feeDistributor;
        address pairFees;
        uint256 pairBps;
    }

    struct ProtocolMetadata {
        address veAddress;
        address emissionsTokenAddress;
        address voterAddress;
        address poolsFactoryAddress;
        address gaugesFactoryAddress;
        address minterAddress;
    }

    struct vePosition {
        uint256 tokenId;
        uint256 balanceOf;
        uint256 locked;
    }

    struct tokenRewardData {
        address token;
        uint256 rewardRate;
    }

    struct gaugeRewardsData {
        address gauge;
        tokenRewardData[] rewardData;
    }

    // user earned per token
    struct userGaugeTokenData {
        address token;
        uint256 earned;
    }

    struct userGaugeRewardData {
        address gauge;
        uint256 balance;
        uint256 derivedBalance;
        userGaugeTokenData[] userRewards;
    }

    // user earned per token for feeDist
    struct userBribeTokenData {
        address token;
        uint256 earned;
    }

    struct userFeeDistData {
        address feeDistributor;
        userBribeTokenData[] bribeData;
    }
    // the amount of nested structs for bribe lmao
    struct userBribeData {
        uint256 tokenId;
        userFeeDistData[] feeDistRewards;
    }

    struct userVeData {
        uint256 tokenId;
        uint256 lockedAmount;
        uint256 votingPower;
        uint256 lockEnd;
    }

    struct Earned {
        address poolAddress;
        address token;
        uint256 amount;
    }

    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor() {
        _disableInitializers();
    }

    function initialize(
        IVoter _voter,
        address _router,
        address _v2Factory,
        address _v2Nfp,
        address _v2Router,
        address _v2QuoterV2,
        address _v2PairFlash
    ) external initializer {
        voter = _voter;
        router = _router;
        ve = IVotingEscrow(voter._ve());
        minter = IMinter(voter.minter());

        v2Factory = _v2Factory;
        v2Nfp = _v2Nfp;
        v2Router = _v2Router;
        v2QuoterV2 = _v2QuoterV2;
        v2PairFlash = _v2PairFlash;
    }

    /**
     * @notice returns the pool factory address
     */
    function poolFactory() public view returns (address pool) {
        pool = voter.factory();
    }

    /**
     * @notice returns the gauge factory address
     */
    function gaugeFactory() public view returns (address _gaugeFactory) {
        _gaugeFactory = voter.gaugefactory();
    }

    /**
     * @notice returns the fee distributor factory address
     */
    function feeDistributorFactory()
        public
        view
        returns (address _gaugeFactory)
    {
        _gaugeFactory = voter.feeDistributorFactory();
    }

    /**
     * @notice returns ra address
     */
    function emissionsTokenAddress()
        public
        view
        returns (address emissionsToken)
    {
        emissionsToken = ve.emissionsToken();
    }

    /**
     * @notice returns the voter address
     */
    function voterAddress() public view returns (address _voter) {
        _voter = address(voter);
    }

    /**
     * @notice returns rewardsDistributor address
     */
    function rewardsDistributor()
        public
        view
        returns (address _rewardsDistributor)
    {
        _rewardsDistributor = address(minter.rewardsDistributor());
    }

    /**
     * @notice returns the minter address
     */
    function minterAddress() public view returns (address _minter) {
        _minter = address(minter);
    }

    /**
     * @notice returns core contract addresses
     */
    function protocolMetadata()
        external
        view
        returns (ProtocolMetadata memory)
    {
        return
            ProtocolMetadata({
                veAddress: voter._ve(),
                voterAddress: voterAddress(),
                emissionsTokenAddress: emissionsTokenAddress(),
                poolsFactoryAddress: poolFactory(),
                gaugesFactoryAddress: gaugeFactory(),
                minterAddress: minterAddress()
            });
    }

    /**
     * @notice returns all RA pool addresses
     */
    function allPools() public view returns (address[] memory pools) {
        IPairFactory _factory = IPairFactory(poolFactory());
        uint256 len = _factory.allPairsLength();

        pools = new address[](len);
        for (uint256 i; i < len; ++i) {
            pools[i] = _factory.allPairs(i);
        }
    }

    /**
     * @notice returns all RA pools that have active gauges
     */
    function allActivePools() public view returns (address[] memory pools) {
        uint256 len = voter.length();
        pools = new address[](len);

        for (uint256 i; i < len; ++i) {
            pools[i] = voter.pools(i);
        }
    }

    /**
     * @notice returns the gauge address for a pool
     * @param pool pool address to check
     */
    function gaugeForPool(address pool) public view returns (address gauge) {
        gauge = voter.gauges(pool);
    }

    /**
     * @notice returns the feeDistributor address for a pool
     * @param pool pool address to check
     */
    function feeDistributorForPool(
        address pool
    ) public view returns (address feeDistributor) {
        address gauge = gaugeForPool(pool);
        feeDistributor = voter.feeDistributors(gauge);
    }

    /**
     * @notice returns current fee rate of a Ra pool
     * @param pool pool address to check
     */
    function pairBps(address pool) public view returns (uint256 bps) {
        bps = IPairFactory(poolFactory()).pairFee(pool);
    }

    /**
     * @notice returns useful information for a pool
     * @param pool pool address to check
     */
    function poolInfo(
        address pool
    ) public view returns (Pool memory _poolInfo) {
        IPair pair = IPair(pool);
        _poolInfo.id = pool;
        _poolInfo.symbol = pair.symbol();
        (_poolInfo.token0, _poolInfo.token1) = pair.tokens();
        _poolInfo.gauge = gaugeForPool(pool);
        _poolInfo.feeDistributor = feeDistributorForPool(pool);
        _poolInfo.pairFees = pair.fees();
        _poolInfo.pairBps = pairBps(pool);
    }

    /**
     * @notice returns useful information for all RA pools
     */
    function allPoolsInfo() public view returns (Pool[] memory _poolsInfo) {
        address[] memory pools = allPools();
        uint256 len = pools.length;

        _poolsInfo = new Pool[](len);
        for (uint256 i; i < len; ++i) {
            _poolsInfo[i] = poolInfo(pools[i]);
        }
    }

    /**
     * @notice returns the gauge address for all active pairs
     */
    function allGauges() public view returns (address[] memory gauges) {
        address[] memory pools = allActivePools();
        uint256 len = pools.length;
        gauges = new address[](len);

        for (uint256 i; i < len; ++i) {
            gauges[i] = gaugeForPool(pools[i]);
        }
    }

    /**
     * @notice returns the feeDistributor address for all active pairs
     */
    function allFeeDistributors()
        public
        view
        returns (address[] memory feeDistributors)
    {
        address[] memory pools = allActivePools();
        uint256 len = pools.length;
        feeDistributors = new address[](len);

        for (uint256 i; i < len; ++i) {
            feeDistributors[i] = feeDistributorForPool(pools[i]);
        }
    }

    /**
     * @notice returns all reward tokens for the fee distributor of a pool
     * @param pool pool address to check
     */
    function bribeRewardsForPool(
        address pool
    ) public view returns (address[] memory rewards) {
        IFeeDistributor feeDist = IFeeDistributor(feeDistributorForPool(pool));
        rewards = feeDist.getRewardTokens();
    }

    /**
     * @notice returns all reward tokens for the gauge of a pool
     * @param pool pool address to check
     */
    function gaugeRewardsForPool(
        address pool
    ) public view returns (address[] memory rewards) {
        IGauge gauge = IGauge(gaugeForPool(pool));
        if (address(gauge) == address(0)) return rewards;

        rewards = gauge.rewardsList();
    }

    /**
     * @notice returns all token id's of a user
     * @param user account address to check
     */
    function veNFTsOf(
        address user
    ) public view returns (uint256[] memory NFTs) {
        uint256 len = ve.balanceOf(user);
        NFTs = new uint256[](len);

        for (uint256 i; i < len; ++i) {
            NFTs[i] = ve.tokenOfOwnerByIndex(user, i);
        }
    }

    /**
     * @notice returns bribes data of a token id per pool
     * @param tokenId the veNFT token id to check
     * @param pool the pool address
     */
    function bribesPositionOf(
        uint256 tokenId,
        address pool
    ) public view returns (userFeeDistData memory rewardsData) {
        IFeeDistributor feeDist = IFeeDistributor(feeDistributorForPool(pool));
        if (address(feeDist) == address(0)) {
            return rewardsData;
        }

        address[] memory rewards = bribeRewardsForPool(pool);
        uint256 len = rewards.length;

        rewardsData.feeDistributor = address(feeDist);
        userBribeTokenData[] memory _userRewards = new userBribeTokenData[](
            len
        );

        for (uint256 i; i < len; ++i) {
            _userRewards[i].token = rewards[i];
            _userRewards[i].earned = feeDist.earned(rewards[i], tokenId);
        }
        rewardsData.bribeData = _userRewards;
    }

    /**
     * @notice returns gauge reward data for a pool
     * @param pool pool address
     */
    function poolRewardsData(
        address pool
    ) public view returns (gaugeRewardsData memory rewardData) {
        address gauge = gaugeForPool(pool);
        if (gauge == address(0)) {
            return rewardData;
        }

        address[] memory rewards = gaugeRewardsForPool(pool);
        uint256 len = rewards.length;
        tokenRewardData[] memory _rewardData = new tokenRewardData[](len);

        for (uint256 i; i < len; ++i) {
            _rewardData[i].token = rewards[i];
            _rewardData[i].rewardRate = IGauge(gauge)
                .rewardData(rewards[i])
                .rewardRate;
        }
        rewardData.gauge = gauge;
        rewardData.rewardData = _rewardData;
    }

    /**
     * @notice returns gauge reward data for multiple Ra pools
     * @param pools RA pools addresses
     */
    function poolsRewardsData(
        address[] memory pools
    ) public view returns (gaugeRewardsData[] memory rewardsData) {
        uint256 len = pools.length;
        rewardsData = new gaugeRewardsData[](len);

        for (uint256 i; i < len; ++i) {
            rewardsData[i] = poolRewardsData(pools[i]);
        }
    }

    /**
     * @notice returns gauge reward data for all Ra pools
     */
    function allPoolsRewardData()
        public
        view
        returns (gaugeRewardsData[] memory rewardsData)
    {
        address[] memory pools = allActivePools();
        rewardsData = poolsRewardsData(pools);
    }

    /**
     * @notice returns veNFT lock data for a token id
     * @param user account address of the user
     */
    function vePositionsOf(
        address user
    ) public view returns (userVeData[] memory veData) {
        uint256[] memory ids = veNFTsOf(user);
        uint256 len = ids.length;
        veData = new userVeData[](len);

        for (uint256 i; i < len; ++i) {
            veData[i].tokenId = ids[i];
            (uint256 amount, uint256 unlockTime) = ve.locked(ids[i]);
            veData[i].lockedAmount = amount;
            veData[i].lockEnd = unlockTime;
            veData[i].votingPower = ve.balanceOfNFT(ids[i]);
        }
    }

    function tokenIdEarned(
        uint256 tokenId,
        address[] memory poolAddresses,
        address[][] memory rewardTokens,
        uint256 maxReturn
    ) external view returns (Earned[] memory earnings) {
        earnings = new Earned[](maxReturn);
        uint256 earningsIndex = 0;
        uint256 amount;

        for (uint256 i; i < poolAddresses.length; ++i) {
            IGauge gauge = IGauge(voter.gauges(poolAddresses[i]));

            if (address(gauge) != address(0)) {
                IFeeDistributor feeDistributor = IFeeDistributor(
                    voter.feeDistributors(address(gauge))
                );

                for (uint256 j; j < rewardTokens[i].length; ++j) {
                    amount = feeDistributor.earned(rewardTokens[i][j], tokenId);
                    if (amount > 0) {
                        earnings[earningsIndex++] = Earned({
                            poolAddress: poolAddresses[i],
                            token: rewardTokens[i][j],
                            amount: amount
                        });
                        require(
                            earningsIndex < maxReturn,
                            "Increase maxReturn"
                        );
                    }
                }
            }
        }
    }

    function addressEarned(
        address user,
        address[] memory poolAddresses,
        uint256 maxReturn
    ) external view returns (Earned[] memory earnings) {
        earnings = new Earned[](maxReturn);
        uint256 earningsIndex = 0;
        uint256 amount;

        for (uint256 i; i < poolAddresses.length; ++i) {
            IGauge gauge = IGauge(voter.gauges(poolAddresses[i]));

            if (address(gauge) != address(0)) {
                address[] memory rewards = gauge.rewardsList();
                uint256 len = rewards.length;
                for (uint256 j; j < len; ++j) {
                    address token = rewards[i];
                    amount = gauge.earned(token, user);
                    if (amount > 0) {
                        earnings[earningsIndex++] = Earned({
                            poolAddress: poolAddresses[i],
                            token: token,
                            amount: amount
                        });
                        require(
                            earningsIndex < maxReturn,
                            "Increase maxReturn"
                        );
                    }
                }
            }
        }
    }

    function addressEarnedCl(
        address user,
        uint256 maxReturn
    ) external view returns (Earned[] memory earnings) {
        earnings = new Earned[](maxReturn);
        uint256 earningsIndex = 0;
        uint256 amount;

        // fetch user NFPs
        uint256 nfpAmount = INonfungiblePositionManager(v2Nfp).balanceOf(user);

        for (uint256 i = 0; i < nfpAmount; ++i) {
            uint256 tokenId = INonfungiblePositionManager(v2Nfp)
                .tokenOfOwnerByIndex(user, i);

            (
                ,
                ,
                address token0,
                address token1,
                uint24 fee,
                ,
                ,
                ,
                ,
                ,
                ,

            ) = INonfungiblePositionManager(v2Nfp).positions(tokenId);

            address poolAddress = PoolAddress.computeAddress(
                v2Factory,
                PoolAddress.PoolKey({token0: token0, token1: token1, fee: fee})
            );

            IGaugeV2 gauge = IGaugeV2(voter.gauges(poolAddress));
            if (address(gauge) != address(0)) {
                address[] memory rewards = gauge.getRewardTokens();

                for (uint256 j = 0; j < rewards.length; ++j) {
                    amount = gauge.earned(rewards[j], tokenId);

                    if (amount > 0) {
                        earnings[earningsIndex++] = Earned({
                            poolAddress: poolAddress,
                            token: rewards[j],
                            amount: amount
                        });
                        require(
                            earningsIndex < maxReturn,
                            "Increase maxReturn"
                        );
                    }
                }
            }
        }
    }

    /// @notice Returns an address's earned cl gauge rewards
    /// @param user User address
    /// @param skip Number of the user's NFPs tokenIds to skip
    /// @param rewardTokens The list of reward tokens interested, returns all tokens if undefined
    /// @param maxReturn Max length of the returned earnings array
    /// @return finished Specifies whether the function has processed all potential rewards
    /// @return currentNfpIndex Specifies the currently processing NFP if finished is false, 0 if finished
    /// @return earnings Earnings for the address
    function addressEarnedClPageable(
        address user,
        uint256 skip,
        address[] calldata rewardTokens,
        uint256 maxReturn
    )
        external
        view
        returns (
            bool finished,
            uint256 currentNfpIndex,
            Earned[] memory earnings
        )
    {
        earnings = new Earned[](maxReturn);
        uint256 earningsIndex = 0;
        uint256 amount;
        uint256 rewardTokensLength = rewardTokens.length;

        // fetch user NFPs
        uint256 nfpAmount = INonfungiblePositionManager(v2Nfp).balanceOf(user);

        for (uint256 i = skip; i < nfpAmount; ++i) {
            uint256 tokenId = INonfungiblePositionManager(v2Nfp)
                .tokenOfOwnerByIndex(user, i);

            (
                ,
                ,
                address token0,
                address token1,
                uint24 fee,
                ,
                ,
                ,
                ,
                ,
                ,

            ) = INonfungiblePositionManager(v2Nfp).positions(tokenId);

            address poolAddress = PoolAddress.computeAddress(
                v2Factory,
                PoolAddress.PoolKey({token0: token0, token1: token1, fee: fee})
            );

            IGaugeV2 gauge = IGaugeV2(voter.gauges(poolAddress));
            if (address(gauge) != address(0)) {
                // construct rewards list
                address[] memory rewards;

                // if rewardTokens is defined, check if elements from list of reward to get is a reward in the gauge
                if (rewardTokensLength > 0) {
                    address[] memory _rewards = new address[](
                        rewardTokensLength
                    );
                    uint256 _reawrdsCount = 0;
                    for (uint256 j = 0; j < rewardTokensLength; j++) {
                        address _reward = rewardTokens[j];
                        if (gauge.isReward(_reward)) {
                            _rewards[_reawrdsCount] = _reward;
                            _reawrdsCount += 1;
                        }
                    }

                    rewards = new address[](_reawrdsCount);
                    for (uint256 j = 0; j < _reawrdsCount; j++) {
                        rewards[j] = _rewards[j];
                    }
                }
                // use all reward tokens reported by the gauge otherwise
                else {
                    rewards = gauge.getRewardTokens();
                }

                // retrieve earned from the gauge for each reward in the rewards array
                for (uint256 j = 0; j < rewards.length; ++j) {
                    amount = gauge.earned(rewards[j], tokenId);
                    // preemptive return if gas left is low
                    if (gasleft() < 1_000_000) {
                        return (false, i, earnings);
                    }

                    if (amount > 0) {
                        earnings[earningsIndex++] = Earned({
                            poolAddress: poolAddress,
                            token: rewards[j],
                            amount: amount
                        });
                        if (earningsIndex == maxReturn) {
                            return (false, i, earnings);
                        }
                    }
                }
            }
        }
        finished = true;
    }

    function tokenIdRebase(
        uint256 tokenId
    ) external view returns (uint256 rebase) {
        rebase = IRewardsDistributor(rewardsDistributor()).claimable(tokenId);
    }

    function tokenIdEarnedSingle(
        uint256 tokenId,
        address feeDistributorAddress,
        address rewardToken
    ) external view returns (uint256 amount) {
        IFeeDistributor feeDistributor = IFeeDistributor(feeDistributorAddress);
        amount = feeDistributor.earned(rewardToken, tokenId);
    }

    function addressEarnedSingle(
        address user,
        address gaugeAddress,
        address rewardToken
    ) external view returns (uint256 amount) {
        IGauge gauge = IGauge(gaugeAddress);
        if (address(gauge) != address(0)) {
            amount = gauge.earned(rewardToken, user);
        }
    }

    function addressEarnedClSingle(
        uint256 tokenId,
        address gaugeAddress,
        address rewardToken
    ) external view returns (uint256 amount) {
        IGaugeV2 gauge = IGaugeV2(gaugeAddress);
        if (address(gauge) != address(0)) {
            amount = gauge.earned(rewardToken, tokenId);
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

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

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```solidity
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 *
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

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

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
     * constructor.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: setting the version to 255 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

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

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized != type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint8) {
        return _initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _initializing;
    }
}

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

pragma solidity ^0.8.0;

import "../IERC721Upgradeable.sol";

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

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

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

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

pragma solidity ^0.8.0;

import "../IERC721Upgradeable.sol";

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

interface IFeeDistributor {
    function initialize(address _voter, address _pairFees) external;

    function _deposit(uint256 amount, uint256 tokenId) external;

    function _withdraw(uint256 amount, uint256 tokenId) external;

    function getRewardForOwner(
        uint256 tokenId,
        address[] memory tokens
    ) external;

    function notifyRewardAmount(address token, uint256 amount) external;

    function getRewardTokens() external view returns (address[] memory);

    function earned(
        address token,
        uint256 tokenId
    ) external view returns (uint256 reward);

    function incentivize(address token, uint256 amount) external;
}

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

interface IGauge {
    function initialize(
        address _stake,
        address _feeDist,
        address _voter,
        bool _forPair
    ) external;

    function getReward(address account, address[] calldata tokens) external;

    function claimFees() external returns (uint256 claimed0, uint256 claimed1);

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

    function rewardsListLength() external view returns (uint256);

    function rewardsList() external view returns (address[] memory);

    function earned(
        address token,
        address account
    ) external view returns (uint256);

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

    function notifyRewardAmount(address token, uint256 amount) external;

    struct Reward {
        uint256 rewardRate;
        uint256 periodFinish;
        uint256 lastUpdateTime;
        uint256 rewardPerTokenStored;
    }

    function rewardData(address token) external view returns (Reward memory);
}

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

import "contracts/interfaces/IRewardsDistributor.sol";

interface IMinter {
    function updatePeriod() external returns (uint256);

    function activePeriod() external view returns (uint256);

    function rewardsDistributor() external view returns (IRewardsDistributor);

    function timelock() external view returns (address);

    function msig() external view returns (address);
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13 || =0.7.6;

interface IPair {
    function initialize(
        address _factory,
        address _token0,
        address _token1,
        bool _stable,
        address _voter
    ) external;

    function metadata()
        external
        view
        returns (
            uint256 dec0,
            uint256 dec1,
            uint256 r0,
            uint256 r1,
            bool st,
            address t0,
            address t1
        );

    function claimFees() external returns (uint256, uint256);

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

    function transferFrom(
        address src,
        address dst,
        uint256 amount
    ) external returns (bool);

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

    function swap(
        uint256 amount0Out,
        uint256 amount1Out,
        address to,
        bytes calldata data
    ) external;

    function burn(
        address to
    ) external returns (uint256 amount0, uint256 amount1);

    function mint(address to) external returns (uint256 liquidity);

    function getReserves()
        external
        view
        returns (
            uint256 _reserve0,
            uint256 _reserve1,
            uint256 _blockTimestampLast
        );

    function getAmountOut(
        uint256 amountIn,
        address tokenIn
    ) external view returns (uint256);

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

    function fees() external view returns (address);

    function setActiveGauge(bool isActive) external;

    function setFeeSplit() external;

    function feeSplit() external view returns (uint8 _feeSplit);

    function stable() external view returns (bool stable);
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13 || =0.7.6;

interface IPairFactory {
    function allPairsLength() external view returns (uint256);

    function isPair(address pair) external view returns (bool);

    function pairCodeHash() external view returns (bytes32);

    function getPair(
        address tokenA,
        address token,
        bool stable
    ) external view returns (address);

    function createPair(
        address tokenA,
        address tokenB,
        bool stable
    ) external returns (address pair);

    function voter() external view returns (address);

    function allPairs(uint256) external view returns (address);

    function pairFee(address) external view returns (uint256);

    function getFee(bool) external view returns (uint256);

    function isPaused() external view returns (bool);

    function acceptFeeManager() external;

    function setFeeManager(address _feeManager) external;

    function setPairFee(address _pair, uint256 _fee) external;

    function setFee(bool _stable, uint256 _fee) external;

    function treasury() external view returns (address);

    function feeSplit() external view returns (uint8);

    function getPoolFeeSplit(
        address _pool
    ) external view returns (uint8 _poolFeeSplit);

    function setFeeSplit(uint8 _toFees, uint8 _toTreasury) external;

    function setPoolFeeSplit(
        address _pool,
        uint8 _toFees,
        uint8 _toTreasury
    ) external;
}

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

interface IRewardsDistributor {
    function checkpointToken() external;

    function checkpointTotalSupply() external;

    function claimable(uint256 _tokenId) external view returns (uint256);

    function claim(uint256 _tokenId) external returns (uint256);

    function claimMany(uint256[] memory _tokenIds) external returns (bool);
}

// SPDX-License-Identifier: MIT
pragma solidity =0.7.6 || ^0.8.13;
pragma abicoder v2;

interface IVoter {
    function _ve() external view returns (address);

    function governor() external view returns (address);

    function emergencyCouncil() external view returns (address);

    function emitDeposit(address account, uint256 amount) external;

    function emitWithdraw(address account, uint256 amount) external;

    function isWhitelisted(address token) external view returns (bool);

    function notifyRewardAmount(uint256 amount) external;

    function distribute(address _gauge) external;

    function gauges(address pool) external view returns (address);

    function feeDistributors(address gauge) external view returns (address);

    function gaugefactory() external view returns (address);

    function feeDistributorFactory() external view returns (address);

    function minter() external view returns (address);

    function factory() external view returns (address);

    function length() external view returns (uint256);

    function pools(uint256) external view returns (address);

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

    function setXRatio(uint256 _xRatio) external;

    function setGaugeXRatio(
        address[] calldata _gauges,
        uint256[] calldata _xRaRatios
    ) external;

    function resetGaugeXRatio(address[] calldata _gauges) external;

    function whitelist(address _token) external;

    function forbid(address _token, bool _status) external;

    function whitelistOperator() external view returns (address);

    function gaugeXRatio(address gauge) external view returns (uint256);

    function isGauge(address gauge) external view returns (bool);

    function killGauge(address _gauge) external;

    function reviveGauge(address _gauge) external;

    function whitelistGaugeReward(address _gauge, address _reward) external;

    function removeGaugeReward(address _gauge, address _reward) external;
}

// SPDX-License-Identifier: MIT
pragma solidity =0.7.6 || ^0.8.13;
pragma abicoder v2;

interface IVotingEscrow {
    struct Point {
        int128 bias;
        int128 slope; // # -dweight / dt
        uint256 ts;
        uint256 blk; // block
    }

    struct LockedBalance {
        int128 amount;
        uint256 end;
    }

    function emissionsToken() external view returns (address);

    function team() external returns (address);

    function epoch() external view returns (uint256);

    function pointHistory(uint256 loc) external view returns (Point memory);

    function userPointHistory(
        uint256 tokenId,
        uint256 loc
    ) external view returns (Point memory);

    function userPointEpoch(uint256 tokenId) external view returns (uint256);

    function ownerOf(uint256) external view returns (address);

    function isApprovedOrOwner(address, uint256) external view returns (bool);

    function transferFrom(address, address, uint256) external;

    function voting(uint256 tokenId) external;

    function abstain(uint256 tokenId) external;

    function checkpoint() external;

    function depositFor(uint256 tokenId, uint256 value) external;

    function createLockFor(
        uint256,
        uint256,
        address
    ) external returns (uint256);

    function balanceOfNFT(uint256) external view returns (uint256);

    function balanceOfNFTAt(uint256, uint256) external view returns (uint256);

    function totalSupply() external view returns (uint256);

    function locked__end(uint256) external view returns (uint256);

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

    function tokenOfOwnerByIndex(
        address,
        uint256
    ) external view returns (uint256);

    function increaseUnlockTime(uint256 tokenID, uint256 duration) external;

    function locked(
        uint256 tokenID
    ) external view returns (uint256 amount, uint256 unlockTime);

    function increaseAmount(uint256 _tokenId, uint256 _value) external;

    function isDelegate(
        address _operator,
        uint256 _tokenId
    ) external view returns (bool);
}

// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0 <0.9.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);
}

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

// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;

import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol";

/// @title ERC721 with permit
/// @notice Extension to ERC721 that includes a permit function for signature based approvals
interface IERC721PermitUpgradeable is IERC721Upgradeable {
    /// @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;
}

// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.5.0 <0.9.0;

interface IGaugeV2 {
    /// @notice Emitted when a reward notification is made.
    /// @param from The address from which the reward is notified.
    /// @param reward The address of the reward token.
    /// @param amount The amount of rewards notified.
    /// @param period The period for which the rewards are notified.
    event NotifyReward(
        address indexed from,
        address indexed reward,
        uint256 amount,
        uint256 period
    );

    /// @notice Emitted when a bribe is made.
    /// @param from The address from which the bribe is made.
    /// @param reward The address of the reward token.
    /// @param amount The amount of tokens bribed.
    /// @param period The period for which the bribe is made.
    event Bribe(
        address indexed from,
        address indexed reward,
        uint256 amount,
        uint256 period
    );

    /// @notice Emitted when rewards are claimed.
    /// @param period The period for which the rewards are claimed.
    /// @param _positionHash The identifier of the NFP for which rewards are claimed.
    /// @param receiver The address of the receiver of the claimed rewards.
    /// @param reward The address of the reward token.
    /// @param amount The amount of rewards claimed.
    event ClaimRewards(
        uint256 period,
        bytes32 _positionHash,
        address receiver,
        address reward,
        uint256 amount
    );

    /// @notice Initializes the contract with the provided gaugeFactory, voter, and pool addresses.
    /// @param _gaugeFactory The address of the gaugeFactory to set.
    /// @param _voter The address of the voter to set.
    /// @param _nfpManager The address of the NFP manager to set.
    /// @param _feeCollector The address of the fee collector to set.
    /// @param _pool The address of the pool to set.
    function initialize(
        address _gaugeFactory,
        address _voter,
        address _nfpManager,
        address _feeCollector,
        address _pool
    ) external;

    /// @notice Retrieves the value of the firstPeriod variable.
    /// @return The value of the firstPeriod variable.
    function firstPeriod() external returns (uint256);

    /// @notice Retrieves the total supply of a specific token for a given period.
    /// @param period The period for which to retrieve the total supply.
    /// @param token The address of the token for which to retrieve the total supply.
    /// @return The total supply of the specified token for the given period.
    function tokenTotalSupplyByPeriod(
        uint256 period,
        address token
    ) external view returns (uint256);

    /// @notice Retrieves the getTokenTotalSupplyByPeriod of the current period.
    /// @dev included to support voter's left() check during distribute().
    /// @param token The address of the token for which to retrieve the remaining amount.
    /// @return The amount of tokens left to distribute in this period.
    function left(address token) external view returns (uint256);

    /// @notice Retrieves the reward rate for a specific reward address.
    /// @dev this method returns the base rate without boost
    /// @param token The address of the reward for which to retrieve the reward rate.
    /// @return The reward rate for the specified reward address.
    function rewardRate(address token) external view returns (uint256);

    /// @notice Retrieves the claimed amount for a specific period, position hash, and user address.
    /// @param period The period for which to retrieve the claimed amount.
    /// @param _positionHash The identifier of the NFP for which to retrieve the claimed amount.
    /// @param reward The address of the token for the claimed amount.
    /// @return The claimed amount for the specified period, token ID, and user address.
    function periodClaimedAmount(
        uint256 period,
        bytes32 _positionHash,
        address reward
    ) external view returns (uint256);

    /// @notice Retrieves the last claimed period for a specific token, token ID combination.
    /// @param token The address of the reward token for which to retrieve the last claimed period.
    /// @param _positionHash The identifier of the NFP for which to retrieve the last claimed period.
    /// @return The last claimed period for the specified token and token ID.
    function lastClaimByToken(
        address token,
        bytes32 _positionHash
    ) external view returns (uint256);

    /// @notice Retrieves the reward address at the specified index in the rewards array.
    /// @param index The index of the reward address to retrieve.
    /// @return The reward address at the specified index.
    function rewards(uint256 index) external view returns (address);

    /// @notice Checks if a given address is a valid reward.
    /// @param reward The address to check.
    /// @return A boolean indicating whether the address is a valid reward.
    function isReward(address reward) external view returns (bool);

    /// @notice Returns an array of reward token addresses.
    /// @return An array of reward token addresses.
    function getRewardTokens() external view returns (address[] memory);

    /// @notice Returns the hash used to store positions in a mapping
    /// @param owner The address of the position owner
    /// @param index The index of the position
    /// @param tickLower The lower tick boundary of the position
    /// @param tickUpper The upper tick boundary of the position
    /// @return _hash The hash used to store positions in a mapping
    function positionHash(
        address owner,
        uint256 index,
        int24 tickLower,
        int24 tickUpper
    ) external pure returns (bytes32);

    /// @notice Retrieves the liquidity and boosted liquidity for a specific NFP.
    /// @param tokenId The identifier of the NFP.
    /// @return liquidity The liquidity of the position token.
    function positionInfo(
        uint256 tokenId
    ) external view returns (uint128 liquidity);

    /// @notice Returns the amount of rewards earned for an NFP.
    /// @param token The address of the token for which to retrieve the earned rewards.
    /// @param tokenId The identifier of the specific NFP for which to retrieve the earned rewards.
    /// @return reward The amount of rewards earned for the specified NFP and tokens.
    function earned(
        address token,
        uint256 tokenId
    ) external view returns (uint256 reward);

    /// @notice Returns the amount of rewards earned during a period for an NFP.
    /// @param period The period for which to retrieve the earned rewards.
    /// @param token The address of the token for which to retrieve the earned rewards.
    /// @param tokenId The identifier of the specific NFP for which to retrieve the earned rewards.
    /// @return reward The amount of rewards earned for the specified NFP and tokens.
    function periodEarned(
        uint256 period,
        address token,
        uint256 tokenId
    ) external view returns (uint256);

    /// @notice Retrieves the earned rewards for a specific period, token, owner, index, tickLower, and tickUpper.
    /// @param period The period for which to retrieve the earned rewards.
    /// @param token The address of the token for which to retrieve the earned rewards.
    /// @param owner The address of the owner for which to retrieve the earned rewards.
    /// @param index The index for which to retrieve the earned rewards.
    /// @param tickLower The tick lower bound for which to retrieve the earned rewards.
    /// @param tickUpper The tick upper bound for which to retrieve the earned rewards.
    /// @return The earned rewards for the specified period, token, owner, index, tickLower, and tickUpper.
    function periodEarned(
        uint256 period,
        address token,
        address owner,
        uint256 index,
        int24 tickLower,
        int24 tickUpper
    ) external view returns (uint256);

    /// @notice Retrieves the earned rewards for a specific period, token, owner, index, tickLower, and tickUpper.
    /// @dev used by getReward() and saves gas by saving states
    /// @param period The period for which to retrieve the earned rewards.
    /// @param token The address of the token for which to retrieve the earned rewards.
    /// @param owner The address of the owner for which to retrieve the earned rewards.
    /// @param index The index for which to retrieve the earned rewards.
    /// @param tickLower The tick lower bound for which to retrieve the earned rewards.
    /// @param tickUpper The tick upper bound for which to retrieve the earned rewards.
    /// @param caching Whether to cache the results or not.
    /// @return The earned rewards for the specified period, token, owner, index, tickLower, and tickUpper.
    function cachePeriodEarned(
        uint256 period,
        address token,
        address owner,
        uint256 index,
        int24 tickLower,
        int24 tickUpper,
        bool caching
    ) external returns (uint256);

    /// @notice Notifies the contract about the amount of rewards to be distributed for a specific token.
    /// @param token The address of the token for which to notify the reward amount.
    /// @param amount The amount of rewards to be distributed.
    function notifyRewardAmount(address token, uint256 amount) external;

    /// @notice Retrieves the reward amount for a specific period, NFP, and token addresses.
    /// @param period The period for which to retrieve the reward amount.
    /// @param tokens The addresses of the tokens for which to retrieve the reward amount.
    /// @param tokenId The identifier of the specific NFP for which to retrieve the reward amount.
    /// @param receiver The address of the receiver of the reward amount.
    function getPeriodReward(
        uint256 period,
        address[] calldata tokens,
        uint256 tokenId,
        address receiver
    ) external;

    /// @notice Retrieves the rewards for a specific period, set of tokens, owner, index, tickLower, tickUpper, and receiver.
    /// @param period The period for which to retrieve the rewards.
    /// @param tokens An array of token addresses for which to retrieve the rewards.
    /// @param owner The address of the owner for which to retrieve the rewards.
    /// @param index The index for which to retrieve the rewards.
    /// @param tickLower The tick lower bound for which to retrieve the rewards.
    /// @param tickUpper The tick upper bound for which to retrieve the rewards.
    /// @param receiver The address of the receiver of the rewards.
    function getPeriodReward(
        uint256 period,
        address[] calldata tokens,
        address owner,
        uint256 index,
        int24 tickLower,
        int24 tickUpper,
        address receiver
    ) external;

    function getRewardForOwner(
        uint256 tokenId,
        address[] memory tokens
    ) external;
}

// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;
pragma abicoder v2;

import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721EnumerableUpgradeable.sol";

import "./IERC721PermitUpgradeable.sol";
import "../../v2-periphery/interfaces/IPeripheryPayments.sol";
import "../../v2-periphery/interfaces/IPeripheryImmutableState.sol";
import "../libraries/PoolAddress.sol";

/// @title Non-fungible token for positions
/// @notice Wraps RA V2 positions in a non-fungible token interface which allows for them to be transferred
/// and authorized.
interface INonfungiblePositionManager is
    IPeripheryPayments,
    IPeripheryImmutableState,
    IERC721MetadataUpgradeable,
    IERC721EnumerableUpgradeable,
    IERC721PermitUpgradeable
{
    /// @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;
    }

    // details about the RA position
    struct Position {
        // the nonce for permits
        uint96 nonce;
        // the address that is approved for spending this token
        address operator;
        // the ID of the pool with which this token is connected
        uint80 poolId;
        // the tick range of the position
        int24 tickLower;
        int24 tickUpper;
        // the liquidity of the position
        uint128 liquidity;
        // the fee growth of the aggregate position as of the last action on the individual position
        uint256 feeGrowthInside0LastX128;
        uint256 feeGrowthInside1LastX128;
        // how many uncollected tokens are owed to the position, as of the last computation
        uint128 tokensOwed0;
        uint128 tokensOwed1;
    }

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

    function isApprovedOrOwner(
        address spender,
        uint256 tokenId
    ) external view returns (bool);
}

// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0 <0.9.0;

/// @title Provides functions for deriving a pool address from the factory, tokens, and the fee
library PoolAddress {
    // @dev this has to be changed if the optimization runs are changed
    // bytes32 internal constant POOL_INIT_CODE_HASH = 0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54;
    bytes32 internal constant POOL_INIT_CODE_HASH =
        0x1565b129f2d1790f12d45301b9b084335626f0c92410bc43130763b69971135d;
    // bytes32 internal constant POOL_INIT_CODE_HASH = 0x5698d96123f1258c1416afb173cca764c73725fcf9189ae4fe4552dc4b25ce5b;

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

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

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

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

Contract Security Audit

Contract ABI

API
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"address[]","name":"poolAddresses","type":"address[]"},{"internalType":"uint256","name":"maxReturn","type":"uint256"}],"name":"addressEarned","outputs":[{"components":[{"internalType":"address","name":"poolAddress","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct Lens.Earned[]","name":"earnings","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"maxReturn","type":"uint256"}],"name":"addressEarnedCl","outputs":[{"components":[{"internalType":"address","name":"poolAddress","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct Lens.Earned[]","name":"earnings","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"skip","type":"uint256"},{"internalType":"address[]","name":"rewardTokens","type":"address[]"},{"internalType":"uint256","name":"maxReturn","type":"uint256"}],"name":"addressEarnedClPageable","outputs":[{"internalType":"bool","name":"finished","type":"bool"},{"internalType":"uint256","name":"currentNfpIndex","type":"uint256"},{"components":[{"internalType":"address","name":"poolAddress","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct Lens.Earned[]","name":"earnings","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"gaugeAddress","type":"address"},{"internalType":"address","name":"rewardToken","type":"address"}],"name":"addressEarnedClSingle","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"gaugeAddress","type":"address"},{"internalType":"address","name":"rewardToken","type":"address"}],"name":"addressEarnedSingle","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"allActivePools","outputs":[{"internalType":"address[]","name":"pools","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"allFeeDistributors","outputs":[{"internalType":"address[]","name":"feeDistributors","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"allGauges","outputs":[{"internalType":"address[]","name":"gauges","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"allPools","outputs":[{"internalType":"address[]","name":"pools","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"allPoolsInfo","outputs":[{"components":[{"internalType":"address","name":"id","type":"address"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"bool","name":"stable","type":"bool"},{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"address","name":"gauge","type":"address"},{"internalType":"address","name":"feeDistributor","type":"address"},{"internalType":"address","name":"pairFees","type":"address"},{"internalType":"uint256","name":"pairBps","type":"uint256"}],"internalType":"struct Lens.Pool[]","name":"_poolsInfo","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"allPoolsRewardData","outputs":[{"components":[{"internalType":"address","name":"gauge","type":"address"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"rewardRate","type":"uint256"}],"internalType":"struct Lens.tokenRewardData[]","name":"rewardData","type":"tuple[]"}],"internalType":"struct Lens.gaugeRewardsData[]","name":"rewardsData","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pool","type":"address"}],"name":"bribeRewardsForPool","outputs":[{"internalType":"address[]","name":"rewards","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"pool","type":"address"}],"name":"bribesPositionOf","outputs":[{"components":[{"internalType":"address","name":"feeDistributor","type":"address"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"earned","type":"uint256"}],"internalType":"struct Lens.userBribeTokenData[]","name":"bribeData","type":"tuple[]"}],"internalType":"struct Lens.userFeeDistData","name":"rewardsData","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emissionsTokenAddress","outputs":[{"internalType":"address","name":"emissionsToken","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeDistributorFactory","outputs":[{"internalType":"address","name":"_gaugeFactory","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pool","type":"address"}],"name":"feeDistributorForPool","outputs":[{"internalType":"address","name":"feeDistributor","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gaugeFactory","outputs":[{"internalType":"address","name":"_gaugeFactory","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pool","type":"address"}],"name":"gaugeForPool","outputs":[{"internalType":"address","name":"gauge","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pool","type":"address"}],"name":"gaugeRewardsForPool","outputs":[{"internalType":"address[]","name":"rewards","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IVoter","name":"_voter","type":"address"},{"internalType":"address","name":"_router","type":"address"},{"internalType":"address","name":"_v2Factory","type":"address"},{"internalType":"address","name":"_v2Nfp","type":"address"},{"internalType":"address","name":"_v2Router","type":"address"},{"internalType":"address","name":"_v2QuoterV2","type":"address"},{"internalType":"address","name":"_v2PairFlash","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"minter","outputs":[{"internalType":"contract IMinter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minterAddress","outputs":[{"internalType":"address","name":"_minter","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pool","type":"address"}],"name":"pairBps","outputs":[{"internalType":"uint256","name":"bps","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolFactory","outputs":[{"internalType":"address","name":"pool","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pool","type":"address"}],"name":"poolInfo","outputs":[{"components":[{"internalType":"address","name":"id","type":"address"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"bool","name":"stable","type":"bool"},{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"address","name":"gauge","type":"address"},{"internalType":"address","name":"feeDistributor","type":"address"},{"internalType":"address","name":"pairFees","type":"address"},{"internalType":"uint256","name":"pairBps","type":"uint256"}],"internalType":"struct Lens.Pool","name":"_poolInfo","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pool","type":"address"}],"name":"poolRewardsData","outputs":[{"components":[{"internalType":"address","name":"gauge","type":"address"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"rewardRate","type":"uint256"}],"internalType":"struct Lens.tokenRewardData[]","name":"rewardData","type":"tuple[]"}],"internalType":"struct Lens.gaugeRewardsData","name":"rewardData","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"pools","type":"address[]"}],"name":"poolsRewardsData","outputs":[{"components":[{"internalType":"address","name":"gauge","type":"address"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"rewardRate","type":"uint256"}],"internalType":"struct Lens.tokenRewardData[]","name":"rewardData","type":"tuple[]"}],"internalType":"struct Lens.gaugeRewardsData[]","name":"rewardsData","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolMetadata","outputs":[{"components":[{"internalType":"address","name":"veAddress","type":"address"},{"internalType":"address","name":"emissionsTokenAddress","type":"address"},{"internalType":"address","name":"voterAddress","type":"address"},{"internalType":"address","name":"poolsFactoryAddress","type":"address"},{"internalType":"address","name":"gaugesFactoryAddress","type":"address"},{"internalType":"address","name":"minterAddress","type":"address"}],"internalType":"struct Lens.ProtocolMetadata","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardsDistributor","outputs":[{"internalType":"address","name":"_rewardsDistributor","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"router","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address[]","name":"poolAddresses","type":"address[]"},{"internalType":"address[][]","name":"rewardTokens","type":"address[][]"},{"internalType":"uint256","name":"maxReturn","type":"uint256"}],"name":"tokenIdEarned","outputs":[{"components":[{"internalType":"address","name":"poolAddress","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct Lens.Earned[]","name":"earnings","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"feeDistributorAddress","type":"address"},{"internalType":"address","name":"rewardToken","type":"address"}],"name":"tokenIdEarnedSingle","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenIdRebase","outputs":[{"internalType":"uint256","name":"rebase","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"v2Factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"v2Nfp","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"v2PairFlash","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"v2QuoterV2","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"v2Router","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ve","outputs":[{"internalType":"contract IVotingEscrow","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"veNFTsOf","outputs":[{"internalType":"uint256[]","name":"NFTs","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"vePositionsOf","outputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"lockedAmount","type":"uint256"},{"internalType":"uint256","name":"votingPower","type":"uint256"},{"internalType":"uint256","name":"lockEnd","type":"uint256"}],"internalType":"struct Lens.userVeData[]","name":"veData","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"voter","outputs":[{"internalType":"contract IVoter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"voterAddress","outputs":[{"internalType":"address","name":"_voter","type":"address"}],"stateMutability":"view","type":"function"}]

60808060405234620000c6576000549060ff8260081c1662000074575060ff8082160362000038575b6040516135af9081620000cc8239f35b60ff90811916176000557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160ff8152a13862000028565b62461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b6064820152608490fd5b600080fdfe60e0604052600436101561001257600080fd5b60003560e01c80630551c4b414611b9857806305fc75bd1461196857806307546172146116925780630d52333c1461194d5780630fb484431461193257806312239c0a1461190e5780631799623a146118e757806318a26840146118af5780631f850716146118885780632045be901461186557806323fcc608146117e85780632795502e146117cc5780632ac0a20d1461176757806331ad2fa3146116b957806334d722c91461169257806335876476146113735780633a9798fe146113545780633f2a5540146113395780634219dc401461131e57806346c96aac14610ec057806347af938f1461129857806347aff5d7146112715780634f2c870a1461112757806370e75d591461108f578063791fbc3a146110475780637d3b6735146110135780638b8177ad14610fec57806392d1c7fb14610f7a5780639647d14114610eea578063992ac9fa14610ec05780639a7b5f1114610e88578063a3e3943014610df8578063ad2d0ca614610b89578063afda47281461083b578063b4b57c3914610814578063bb261405146107f0578063c12ae085146103b2578063c5c63e651461038a578063da282ff31461035f578063deadbc1414610338578063e54c666314610297578063f25aaa31146102215763f887ea40146101f557600080fd5b3461021c57600036600319011261021c5760206001600160a01b0360035416604051908152f35b600080fd5b3461021c57600036600319011261021c5761023a6124a4565b805161024581612472565b9160005b828110610262576040518061025e8682611da6565b0390f35b6001906001600160a01b036102828161027b84876120d8565b5116612863565b9061028d83886120d8565b9116905201610249565b3461021c57604036600319011261021c576102bb6102b3611d7a565b600435613385565b60405160209160208252602060608301916001600160a01b0381511682850152015190604080840152815180915260206080840192019360005b8281106103025784840385f35b909192826040826103296001948a51602080916001600160a01b0381511684520151910152565b019601910194929190946102f5565b3461021c57600036600319011261021c5760206001600160a01b0360065416604051908152f35b3461021c57602036600319011261021c57602061038261037d611d64565b613313565b604051908152f35b3461021c57600036600319011261021c5761025e6103a661320a565b60405191829182611da6565b3461021c57604036600319011261021c576103cb611d64565b6103d6602435612ae0565b9060006001600160a01b0360055416604051916370a0823160e01b83526001600160a01b0384166004840152602083602481855afa9283156106ba576000936107bc575b506000939293926001600160a01b0360045416906001600160a01b0360005460101c16945b86811061045c576040516020808252819061025e9082018b61202a565b604051632f745c5960e01b81526001600160a01b038316600482015260248101829052602081604481895afa9081156106ba5760009161078a575b5060405163133f757160e31b815260048101829052610180816024818a5afa9081156106ba57610500916000906000809161073a575b62ffffff9293506001600160a01b039081604051956104eb87611f48565b168552166020840152166040820152856134ee565b9060405163b9a09fd560e01b81526001600160a01b03831660048201526020816024818c5afa9081156106ba57600091610700575b506001600160a01b038116610550575b50505060010161043f565b93929891979094966040519763c4f59f9b60e01b89526000896004816001600160a01b038a165afa9889156106ba576000996106db575b5060005b89518110156106c6576105df6020896001600160a01b036105ac858f6120d8565b51166040519384928392633e491d4760e01b845260048401602090939291936001600160a01b0360408201951681520152565b03816001600160a01b038c165afa9081156106ba578c918f91600091610683575b508c81610614575b5050505060010161058b565b84610622919d93949d6120d8565b516001600160a01b03166040519c6106398e611f48565b6001600160a01b03168d5260208d015260408c015261065781612c20565b9a61066282846120d8565b5261066c916120d8565b5061067a6024358a10613183565b8a8d8f8c610608565b925050506020813d6020116106b2575b816106a060209383611f80565b8101031261021c578d8c915138610600565b3d9150610693565b6040513d6000823e3d90fd5b50955096509650966001919250908980610545565b6106f99199503d806000833e6106f18183611f80565b8101906121ba565b978c610587565b90506020813d602011610732575b8161071b60209383611f80565b8101031261021c5761072c90612102565b8b610535565b3d915061070e565b50505062ffffff61076c6001600160a01b03926101803d61018011610783575b6107648183611f80565b810190612b73565b5050505050505093509491509390508392506104cd565b503d61075a565b90506020813d6020116107b4575b816107a560209383611f80565b8101031261021c575189610497565b3d9150610798565b9092506020813d6020116107e8575b816107d860209383611f80565b8101031261021c5751918561041a565b3d91506107cb565b3461021c57602036600319011261021c5761025e6103a661080f611d64565b6131cf565b3461021c57600036600319011261021c5760206001600160a01b0360045416604051908152f35b3461021c57608036600319011261021c5767ffffffffffffffff60243581811161021c5761086d903690600401611fba565b906044359080821161021c573660238301121561021c57816004013561089281611fa2565b926108a06040519485611f80565b8184526024602085019260051b8201019136831161021c5760248201905b838210610b615785876108d2606435612ae0565b916000906000916001600160a01b0360005460101c16925b8451811015610b4b576001600160a01b0361090582876120d8565b5160405163b9a09fd560e01b815291166004820152602081602481885afa80156106ba57600090610b0b575b6001600160a01b039150168061094b575b506001016108ea565b949093604051956324f24ba560e11b87526004870152602086602481845afa9586156106ba57600096610acf575b5060005b61098786866120d8565b5151811015610ac3576109e760206001600160a01b036109b1846109ab8b8b6120d8565b516120d8565b511660405180938192633e491d4760e01b83526004359060048401602090939291936001600160a01b0360408201951681520152565b03816001600160a01b038c165afa9081156106ba57600091610a91575b5080610a14575b5060010161097d565b9390610a7d6001926001600160a01b03610a2e8a886120d8565b5116966001600160a01b03610a47856109ab8d8d6120d8565b511660405198610a568a611f48565b895260208901526040880152610a6b81612c20565b96610a76828d6120d8565b528a6120d8565b50610a8b6064358610613183565b90610a0b565b90506020813d602011610abb575b81610aac60209383611f80565b8101031261021c575189610a04565b3d9150610a9f565b50909450926001610942565b9095506020813d602011610b03575b81610aeb60209383611f80565b8101031261021c57610afc90612102565b9487610979565b3d9150610ade565b506020813d602011610b43575b81610b2560209383611f80565b8101031261021c57610b3e6001600160a01b0391612102565b610931565b3d9150610b18565b6040516020808252819061025e9082018961202a565b813585811161021c57602091610b7e839260243691880101611fba565b8152019101906108be565b3461021c57606036600319011261021c57610ba2611d64565b60243567ffffffffffffffff811161021c57610bc2903690600401611fba565b90610bce604435612ae0565b6000916000936001600160a01b0360005460101c16945b8151811015610de2576001600160a01b03610c0082846120d8565b5160405163b9a09fd560e01b8152911660048201526020816024818a5afa9081156106ba57600091610da8575b506001600160a01b038116610c46575b50600101610be5565b604051632000ed8560e21b81526000816004816001600160a01b0386165afa9081156106ba57600091610d8d575b5080519060005b828110610c8a57505050610c3d565b6001600160a01b03610c9c86846120d8565b5160405163211dc32d60e01b815291166001600160a01b0381811660048401528916602483015290602081806044810103816001600160a01b038a165afa9081156106ba57600091610d5b575b5080610cfa575b5050600101610c7b565b600192919a610d46916001600160a01b03610d158a8c6120d8565b51169c60206040519e8f90610d2982611f48565b8152015260408d0152610d3b81612c20565b9b610a76828d6120d8565b50610d546044358b10613183565b908b610cf0565b90506020813d602011610d85575b81610d7660209383611f80565b8101031261021c57518c610ce9565b3d9150610d69565b610da291503d806000833e6106f18183611f80565b88610c74565b90506020813d602011610dda575b81610dc360209383611f80565b8101031261021c57610dd490612102565b87610c2d565b3d9150610db6565b6040516020808252819061025e9082018761202a565b3461021c57608036600319011261021c57610e11611d64565b60443567ffffffffffffffff80821161021c573660238301121561021c57816004013590811161021c573660248260051b8401011161021c57610e5f92602460643593019060243590612c45565b61025e60a05191929160405193849315158452602084015260606040840152606083019061202a565b3461021c57602036600319011261021c5761025e610eac610ea7611d64565b6128ad565b604051918291602083526020830190611ccc565b3461021c57600036600319011261021c5760206001600160a01b0360005460101c16604051908152f35b3461021c57600036600319011261021c5760046001600160a01b0360208160005460101c1660405193848092639647d14160e01b82525afa9081156106ba57600091610f3e575b6020925060405191168152f35b90506020823d602011610f72575b81610f5960209383611f80565b8101031261021c57610f6c602092612102565b90610f31565b3d9150610f4c565b3461021c57600036600319011261021c57610f936124a4565b8051610f9e81612472565b9160005b828110610fb7576040518061025e8682611da6565b6001906001600160a01b03610fd781610fd084876120d8565b5116612431565b90610fe283886120d8565b9116905201610fa2565b3461021c57600036600319011261021c5760206001600160a01b0360055416604051908152f35b3461021c57602036600319011261021c576020611036611031611d64565b612863565b6001600160a01b0360405191168152f35b3461021c57602036600319011261021c5760043567ffffffffffffffff811161021c5761108361107e61025e923690600401611fba565b6127ca565b60405191829182611e96565b3461021c576110d660206110a236611e61565b604051633e491d4760e01b81526001600160a01b039182166004820152602481019390935291938492839182906044820190565b0392165afa80156106ba576000906110f4575b602090604051908152f35b506020813d60201161111f575b8161110e60209383611f80565b8101031261021c57602090516110e9565b3d9150611101565b3461021c57600036600319011261021c5760405161114481611f2c565b60008152600060a0602092828482015282604082015282606082015282608082015201526001600160a01b03908160005460101c1660405191638dd598fb60e01b83528083600481855afa9283156106ba5760009361122d575b60c06111d9868681878188816111b2612185565b936111bb612792565b92826111c5612116565b9660a08280600254169b6040519e8f611f2c565b169c8d815283858201931683526040810195865283606082019816885283608082019a168a5201998a526040519b8c525116908a0152511660408801525116606086015251166080840152511660a0820152f35b939192508084813d831161126a575b6112468183611f80565b8101031261021c57816111d9938161125f60c097612102565b95505092945061119e565b503d61123c565b3461021c57600036600319011261021c5760206001600160a01b0360075416604051908152f35b3461021c5760208060031936011261021c576024816001600160a01b036112bd612723565b166040519283809263d1d58b2560e01b825260043560048301525afa9081156106ba576000916112f1575b50604051908152f35b90508181813d8311611317575b6113088183611f80565b8101031261021c5751826112e8565b503d6112fe565b3461021c57600036600319011261021c576020611036612792565b3461021c57600036600319011261021c576020611036612723565b3461021c57600036600319011261021c5761025e61108361107e6124a4565b3461021c5760e036600319011261021c576004356001600160a01b03808216820361021c576113a0611d7a565b906113a9611d90565b916064359082821680920361021c576084359083821680920361021c5760a43584811680910361021c5760c4359285841680940361021c576000549460ff8660081c161595868097611685575b801561166e575b156116035760ff198116600117600055866115f1575b5075ffffffffffffffffffffffffffffffffffffffff00006000549960101b169680887fffffffffffffffffffff0000000000000000000000000000000000000000ffff8c161780600055817fffffffffffffffffffffffff0000000000000000000000000000000000000000971687600354161760035560101c169860405199638dd598fb60e01b8b5260209a8b81600481855afa9182156106ba57848d926000946115b4575b5060049316896001541617600155604051928380926303aa30b960e11b82525afa80156106ba57839160009161157c575b501686600254161760025516846004541617600455836005541617600555826006541617600655816007541617600755600854161760085561152a57005b7fffffffffffffffffffff000000000000000000000000000000000000000000ff7f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249893161760005560405160018152a1005b8092508c8092503d83116115ad575b6115958183611f80565b8101031261021c576115a78391612102565b8d6114ec565b503d61158b565b92809294508391503d83116115ea575b6115ce8183611f80565b8101031261021c57600491846115e48e93612102565b936114bb565b503d6115c4565b61ffff19166101011760005589611413565b60405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608490fd5b50303b1580156113fd5750600160ff8216146113fd565b50600160ff8216106113f6565b3461021c57600036600319011261021c5760206001600160a01b0360025416604051908152f35b3461021c576116c736611e61565b916001600160a01b0360009216806116e5575b602083604051908152f35b604051633e491d4760e01b81526001600160a01b03909416600485015260248401919091526020915082908180604481015b03915afa80156106ba57600090611734575b6020915082806116da565b506020813d60201161175f575b8161174e60209383611f80565b8101031261021c5760209051611729565b3d9150611741565b3461021c5760208060031936011261021c57611789611784611d64565b6125d7565b906040519181839283018184528251809152816040850193019160005b8281106117b557505050500390f35b8351855286955093810193928101926001016117a6565b3461021c57600036600319011261021c5761025e6103a66124a4565b3461021c57606036600319011261021c57611801611d64565b611809611d7a565b611811611d90565b916001600160a01b03600092168061182e57602083604051908152f35b60405163211dc32d60e01b81526001600160a01b039485166004820152939091166024840152602091508290818060448101611717565b3461021c57602036600319011261021c576020611036611883611d64565b612431565b3461021c57600036600319011261021c5760206001600160a01b0360015416604051908152f35b3461021c57602036600319011261021c5761025e6118d36118ce611d64565b6122b3565b604051918291602083526020830190611deb565b3461021c57600036600319011261021c5760206001600160a01b0360085416604051908152f35b3461021c57602036600319011261021c5761025e6103a661192d611d64565b61223c565b3461021c57600036600319011261021c576020611036612185565b3461021c57600036600319011261021c576020611036612116565b3461021c5760208060031936011261021c57611985611784611d64565b9081519161199283611fa2565b926119a06040519485611f80565b8084526119ac81611fa2565b601f190160005b818110611b6057505060006001926001600160a01b0360015416915b838110611a345750505050604051918083018184528451809152816040850195019160005b828110611a015785870386f35b835180518852828101518389015260408082015190890152606090810151908801526080909601959281019284016119f4565b611a4181839896986120d8565b51611a4c82876120d8565b5152611a5881836120d8565b519060405191635a2d1e0760e11b835260048301526024916040818481885afa9081156106ba57600090600092611b27575b5088611a96848a6120d8565b5101526060611aa583896120d8565b51015286611ab382856120d8565b516040519384916339f890b560e21b8352600483015281875afa80156106ba578892600091611af6575b506040611aea83896120d8565b510152019593956119cf565b809350888092503d8311611b20575b611b0f8183611f80565b8101031261021c5787915189611add565b503d611b05565b9150506040813d604011611b58575b81611b4360409383611f80565b8101031261021c57878151910151908a611a8a565b3d9150611b36565b8490604096949651611b7181611efa565b600081526000838201526000604082015260006060820152828287010152019492946119b3565b3461021c57600036600319011261021c57611bb161320a565b8051611bbc81611fa2565b90611bca6040519283611f80565b808252611bd681611fa2565b60209390601f19018460005b828110611c935750505060005b828110611c58575050506040519082820192808352815180945260408301938160408260051b8601019301916000955b828710611c2c5785850386f35b909192938280611c48600193603f198a82030186528851611ccc565b9601920196019592919092611c1f565b80611c776001600160a01b03611c70600194866120d8565b51166128ad565b611c8182876120d8565b52611c8c81866120d8565b5001611bef565b611c9b612080565b828288010152018590611be2565b60005b838110611cbc5750506000910152565b8181015183820152602001611cac565b906101206001600160a01b039283815116835260208101519382602085015284518093850152611d06836101409660208888019101611ca9565b6040820151151560408501528060608301511660608501528060808301511660808501528060a08301511660a08501528060c08301511660c085015260e08201511660e08401526101008091015190830152601f8019910116010190565b600435906001600160a01b038216820361021c57565b602435906001600160a01b038216820361021c57565b604435906001600160a01b038216820361021c57565b602090602060408183019282815285518094520193019160005b828110611dce575050505090565b83516001600160a01b031685529381019392810192600101611dc0565b60409060408301906001600160a01b038151168452602060608180930151956040838201528651809552019401926000905b838210611e2c57505050505090565b9091929394838282611e546001948a51602080916001600160a01b0381511684520151910152565b0196019493920190611e1d565b606090600319011261021c57600435906001600160a01b0390602435828116810361021c5791604435908116810361021c5790565b6020808201906020835283518092526040830192602060408460051b8301019501936000915b848310611ecc5750505050505090565b9091929394958480611eea600193603f198682030187528a51611deb565b9801930193019194939290611ebc565b6080810190811067ffffffffffffffff821117611f1657604052565b634e487b7160e01b600052604160045260246000fd5b60c0810190811067ffffffffffffffff821117611f1657604052565b6060810190811067ffffffffffffffff821117611f1657604052565b6040810190811067ffffffffffffffff821117611f1657604052565b90601f8019910116810190811067ffffffffffffffff821117611f1657604052565b67ffffffffffffffff8111611f165760051b60200190565b9080601f8301121561021c576020908235611fd481611fa2565b93611fe26040519586611f80565b81855260208086019260051b82010192831161021c57602001905b82821061200b575050505090565b81356001600160a01b038116810361021c578152908301908301611ffd565b90815180825260208080930193019160005b82811061204a575050505090565b835180516001600160a01b039081168752818401511686840152604090810151908601526060909401939281019260010161203c565b60405190610120820182811067ffffffffffffffff821117611f165760405281610100600091828152606060208201528260408201528260608201528260808201528260a08201528260c08201528260e08201520152565b80518210156120ec5760209160051b010190565b634e487b7160e01b600052603260045260246000fd5b51906001600160a01b038216820361021c57565b600460206001600160a01b0360005460101c16604051928380926368c3acb360e01b82525afa9081156106ba5760009161214e575090565b90506020813d60201161217d575b8161216960209383611f80565b8101031261021c5761217a90612102565b90565b3d915061215c565b600460206001600160a01b03600154166040519283809263210ca05d60e01b82525afa9081156106ba5760009161214e575090565b602090818184031261021c5780519067ffffffffffffffff821161021c57019180601f8401121561021c5782516121f081611fa2565b936121fe6040519586611f80565b818552838086019260051b82010192831161021c578301905b828210612225575050505090565b83809161223184612102565b815201910190612217565b61224d6001600160a01b0391612431565b16801561229357600060049160405192838092632000ed8560e21b82525afa9081156106ba5760009161227e575090565b61217a91503d806000833e6106f18183611f80565b50606090565b604051906122a682611f64565b6060602083600081520152565b906122bc612299565b916001600160a01b0390816122d082612431565b1690811561242c576122e19061223c565b8051906122ed82611fa2565b936040916122fd83519687611f80565b838652601f1961230c85611fa2565b0160005b81811061240857505060005b84811061233157505050505083526020830152565b8261233c82846120d8565b511661234882896120d8565b51528261235582846120d8565b51855163091cbb3f60e31b8152911660048201526080919082816024818b5afa9081156123fd5760009161239f575b5060019250516020612396838b6120d8565b5101520161231c565b919282813d83116123f6575b6123b58183611f80565b810103126123f357508451600192916123cd82611efa565b805182526020808201519083015286810151878301526060809101519082015238612384565b80fd5b503d6123ab565b86513d6000823e3d90fd5b602090855161241681611f64565b6000815282600081830152828b01015201612310565b505050565b60206001600160a01b0360248160005460101c1693604051948593849263b9a09fd560e01b84521660048301525afa9081156106ba5760009161214e575090565b9061247c82611fa2565b6124896040519182611f80565b828152809261249a601f1991611fa2565b0190602036910137565b6001600160a01b039060009180835460101c169060409060405192630fbdb69960e11b84526020956004968086600481865afa9586156125cc578296612599575b506124ef86612472565b97825b878110612503575050505050505050565b86516315895f4760e31b81528281018290528381602481895afa90811561258f5790878c93928792612547575b5061253d836001956120d8565b91169052016124f2565b92935050508381813d8311612588575b6125618183611f80565b8101031261258457908a8761253d8361257b600196612102565b93955050612530565b8480fd5b503d612557565b88513d87823e3d90fd5b9080965081813d83116125c5575b6125b18183611f80565b810103126125c1575194386124e5565b5080fd5b503d6125a7565b6040513d84823e3d90fd5b906001600160a01b039160019083600154169060408051926370a0823160e01b8452600496831660048501526020908185602481845afa9485156106ba576000956126f4575b5061262785611fa2565b936126356040519586611f80565b858552601f1961264487611fa2565b013684870137849860005b87811061266157505050505050505050565b8551632f745c5960e01b81526001600160a01b038416838201908152602081018390528690829081906040010381885afa9081156126e957908a92916000916126b7575b506126b0828a6120d8565b520161264f565b9192508682813d83116126e2575b6126cf8183611f80565b810103126123f3575090899151386126a5565b503d6126c5565b87513d6000823e3d90fd5b90948282813d831161271c575b61270b8183611f80565b810103126123f3575051933861261d565b503d612701565b6001600160a01b036004602082600254166040519283809262fca95560e61b82525afa9081156106ba5760009161275957501690565b6020813d60201161278a575b8161277260209383611f80565b810103126125c157519082821682036123f357501690565b3d9150612765565b600460206001600160a01b0360005460101c166040519283809263c45a015560e01b82525afa9081156106ba5760009161214e575090565b9081516127d681611fa2565b6127e36040519182611f80565b818152601f196127f283611fa2565b0160005b81811061284c575050809360005b8381106128115750505050565b806128306001600160a01b03612829600194866120d8565b51166122b3565b61283a82866120d8565b5261284581856120d8565b5001612804565b602090612857612299565b828286010152016127f6565b61286c90612431565b60206001600160a01b0360248160005460101c169360405194859384926324f24ba560e11b84521660048301525afa9081156106ba5760009161214e575090565b906128b6612080565b6001600160a01b03808416808352604080516395d89b4160e01b81529395929160008086600481855afa958615612ad4578196612a30575b5060209586890152825191634eb1c24560e11b83528383600481845afa928315612a265790858892849085966129d4575b50816004961660808d01521660608b01528561293a88612431565b1660a08b01528561294a88612863565b1660c08b01528451634d78e9ad60e11b815293849182905afa9283156129ca5750809261298c575b505061298493501660e0850152613313565b610100830152565b915091929382813d83116129c3575b6129a58183611f80565b810103126123f35750906129bc6129849392612102565b3880612972565b503d61299b565b51903d90823e3d90fd5b935050509192508381813d8311612a1f575b6129f08183611f80565b81010312612a1b5760049291858281612a148b612a0d8197612102565b9301612102565b965061291f565b8280fd5b503d6129e6565b84513d84823e3d90fd5b9095503d8087833e612a428183611f80565b810190602081830312612ad057805167ffffffffffffffff91828211612acc570182601f82011215612ab4578051918211612ab857845192612a8e601f8401601f191660200185611f80565b82845260208383010111612ab45790612aad9160208085019101611ca9565b94386128ee565b8780fd5b634e487b7160e01b88526041600452602488fd5b8880fd5b8680fd5b508251903d90823e3d90fd5b90612aea82611fa2565b604090612afa6040519182611f80565b8381528093612b0b601f1991611fa2565b019160009160005b848110612b21575050505050565b6020908351612b2f81611f48565b8581528286818301528686830152828501015201612b13565b51908160020b820361021c57565b51906fffffffffffffffffffffffffffffffff8216820361021c57565b91908261018091031261021c5781516bffffffffffffffffffffffff8116810361021c5791612ba460208201612102565b91612bb160408301612102565b91612bbe60608201612102565b91608082015162ffffff8116810361021c5791612bdd60a08201612b48565b91612bea60c08301612b48565b91612bf760e08201612b56565b91610100820151916101208101519161217a610160612c196101408501612b56565b9301612b56565b6000198114612c2f5760010190565b634e487b7160e01b600052601160045260246000fd5b92939190600060a052600094612c5a84612ae0565b60a0526000926001600160a01b036005541695604051936370a0823160e01b85526001600160a01b03821660048601526020856024818b5afa9485156106ba5760009561314f575b50969396936001600160a01b0360045416916001600160a01b0360005460101c16955b898110612cdb5750505050505050505050600191565b604051632f745c5960e01b81526001600160a01b038316600482015260248101829052602081604481875afa9081156106ba5760009161311d575b5060405163133f757160e31b81526004810182905261018081602481885afa9081156106ba57612d7f91600090600080916130dd575b62ffffff9293506001600160a01b03908160405195612d6a87611f48565b168552166020840152166040820152866134ee565b60405163b9a09fd560e01b81526001600160a01b03821660048201526020816024818d5afa80156106ba57600060c0526130a2575b506001600160a01b0360c05116612dd0575b5050600101612cc5565b979295909b9460009d9b9497929d5082151560001461305057612df283612472565b976000805b858110612f855750612e0881612472565b9960005b828110612f5c575050505b60005b8951811015612f4457612e3c8f6020906001600160a01b036105ac858f6120d8565b03816001600160a01b0360c051165afa9081156106ba57600091612f12575b50620f42405a10612efd5780612e75575b50600101612e1a565b6001600160a01b03612e87838d6120d8565b5116604051608052612e9a608051611f48565b6001600160a01b038d16608051526020608051015260406080510152612edb612ec28d612c20565b9c608051612ed28260a0516120d8565b5260a0516120d8565b508c8c14612ee95738612e6c565b5060009e9d50505050505050505050505050565b5060009f9e5050505050505050505050505050565b90506020813d602011612f3c575b81612f2d60209383611f80565b8101031261021c575138612e5b565b3d9150612f20565b50949b9d9196939850949b5060019196509038612dc6565b808c612f7e826001600160a01b03612f76600196886120d8565b5116926120d8565b5201612e0c565b908160051b8501356001600160a01b038116810361021c576040516309ab9c0760e31b81526001600160a01b03821660048201526020816024816001600160a01b0360c051165afa9081156106ba57600091613015575b50612fec575b5090600101612df7565b6001600160a01b0316612fff828d6120d8565b52600181018111612c2f57600180910190612fe2565b90506020813d602011613048575b8161303060209383611f80565b8101031261021c5751801515810361021c5738612fdc565b3d9150613023565b60405163c4f59f9b60e01b81526000816004816001600160a01b0360c051165afa9081156106ba57600091613087575b5097612e17565b61309c91503d806000833e6106f18183611f80565b38613080565b6020813d6020116130d5575b816130bb60209383611f80565b8101031261021c576130cc90612102565b60c05238612db4565b3d91506130ae565b50505062ffffff6131066001600160a01b03926101803d61018011610783576107648183611f80565b505050505050509350949150939050839250612d4c565b90506020813d602011613147575b8161313860209383611f80565b8101031261021c575138612d16565b3d915061312b565b9094506020813d60201161317b575b8161316b60209383611f80565b8101031261021c57519338612ca2565b3d915061315e565b1561318a57565b60405162461bcd60e51b815260206004820152601260248201527f496e637265617365206d617852657475726e00000000000000000000000000006044820152606490fd5b60006001600160a01b036131e4600493612863565b166040519283809263c4f59f9b60e01b82525afa9081156106ba5760009161227e575090565b6001600160a01b03908161321c612792565b1691604080519163574f2ba360e01b83526020946004958085600481855afa9485156106ba576000956132e4575b5061325485612472565b9660005b8681106132685750505050505050565b8551631e3dd18b60e01b81528281018290528381602481885afa9081156126e9576000916132ab575b5090600191866132a1838d6120d8565b9116905201613258565b908482813d83116132dd575b6132c18183611f80565b810103126123f35750906132d6600192612102565b9091613291565b503d6132b7565b9080955081813d831161330c575b6132fc8183611f80565b8101031261021c5751933861324a565b503d6132f2565b60206001600160a01b03602481613328612792565b1693604051948593849263841fa66b60e01b84521660048301525afa9081156106ba57600091613356575090565b90506020813d60201161337d575b8161337160209383611f80565b8101031261021c575190565b3d9150613364565b919091613390612299565b926001600160a01b0391826133a483612863565b169182156134e8576133b5906131cf565b908151928087526133c584611fa2565b946040936133d66040519788611f80565b858752601f196133e587611fa2565b0160005b8181106134c457505060005b86811061340a57505050505050506020830152565b8261341582846120d8565b5116613421828a6120d8565b51528261342e82846120d8565b518751633e491d4760e01b815291166001600160a01b0316600482015260248101869052906020808380604481010381895afa9081156134b957600091613487575b6001935061347e838c6120d8565b510152016133f5565b9192908282813d83116134b2575b61349f8183611f80565b810103126123f357505160019291613470565b503d613495565b88513d6000823e3d90fd5b60209087516134d281611f64565b6000815282600081830152828c010152016133e9565b50505050565b6001600160a01b0391828151169083602082015116908183101561021c57604062ffffff910151166040519160208301938452604083015260608201526060815261353881611efa565b51902060405190602082019260ff60f81b84526bffffffffffffffffffffffff199060601b16602183015260358201527f1565b129f2d1790f12d45301b9b084335626f0c92410bc43130763b69971135d60558201526055815261359b81611efa565b519020169056fea164736f6c6343000817000a

Deployed Bytecode

0x60e0604052600436101561001257600080fd5b60003560e01c80630551c4b414611b9857806305fc75bd1461196857806307546172146116925780630d52333c1461194d5780630fb484431461193257806312239c0a1461190e5780631799623a146118e757806318a26840146118af5780631f850716146118885780632045be901461186557806323fcc608146117e85780632795502e146117cc5780632ac0a20d1461176757806331ad2fa3146116b957806334d722c91461169257806335876476146113735780633a9798fe146113545780633f2a5540146113395780634219dc401461131e57806346c96aac14610ec057806347af938f1461129857806347aff5d7146112715780634f2c870a1461112757806370e75d591461108f578063791fbc3a146110475780637d3b6735146110135780638b8177ad14610fec57806392d1c7fb14610f7a5780639647d14114610eea578063992ac9fa14610ec05780639a7b5f1114610e88578063a3e3943014610df8578063ad2d0ca614610b89578063afda47281461083b578063b4b57c3914610814578063bb261405146107f0578063c12ae085146103b2578063c5c63e651461038a578063da282ff31461035f578063deadbc1414610338578063e54c666314610297578063f25aaa31146102215763f887ea40146101f557600080fd5b3461021c57600036600319011261021c5760206001600160a01b0360035416604051908152f35b600080fd5b3461021c57600036600319011261021c5761023a6124a4565b805161024581612472565b9160005b828110610262576040518061025e8682611da6565b0390f35b6001906001600160a01b036102828161027b84876120d8565b5116612863565b9061028d83886120d8565b9116905201610249565b3461021c57604036600319011261021c576102bb6102b3611d7a565b600435613385565b60405160209160208252602060608301916001600160a01b0381511682850152015190604080840152815180915260206080840192019360005b8281106103025784840385f35b909192826040826103296001948a51602080916001600160a01b0381511684520151910152565b019601910194929190946102f5565b3461021c57600036600319011261021c5760206001600160a01b0360065416604051908152f35b3461021c57602036600319011261021c57602061038261037d611d64565b613313565b604051908152f35b3461021c57600036600319011261021c5761025e6103a661320a565b60405191829182611da6565b3461021c57604036600319011261021c576103cb611d64565b6103d6602435612ae0565b9060006001600160a01b0360055416604051916370a0823160e01b83526001600160a01b0384166004840152602083602481855afa9283156106ba576000936107bc575b506000939293926001600160a01b0360045416906001600160a01b0360005460101c16945b86811061045c576040516020808252819061025e9082018b61202a565b604051632f745c5960e01b81526001600160a01b038316600482015260248101829052602081604481895afa9081156106ba5760009161078a575b5060405163133f757160e31b815260048101829052610180816024818a5afa9081156106ba57610500916000906000809161073a575b62ffffff9293506001600160a01b039081604051956104eb87611f48565b168552166020840152166040820152856134ee565b9060405163b9a09fd560e01b81526001600160a01b03831660048201526020816024818c5afa9081156106ba57600091610700575b506001600160a01b038116610550575b50505060010161043f565b93929891979094966040519763c4f59f9b60e01b89526000896004816001600160a01b038a165afa9889156106ba576000996106db575b5060005b89518110156106c6576105df6020896001600160a01b036105ac858f6120d8565b51166040519384928392633e491d4760e01b845260048401602090939291936001600160a01b0360408201951681520152565b03816001600160a01b038c165afa9081156106ba578c918f91600091610683575b508c81610614575b5050505060010161058b565b84610622919d93949d6120d8565b516001600160a01b03166040519c6106398e611f48565b6001600160a01b03168d5260208d015260408c015261065781612c20565b9a61066282846120d8565b5261066c916120d8565b5061067a6024358a10613183565b8a8d8f8c610608565b925050506020813d6020116106b2575b816106a060209383611f80565b8101031261021c578d8c915138610600565b3d9150610693565b6040513d6000823e3d90fd5b50955096509650966001919250908980610545565b6106f99199503d806000833e6106f18183611f80565b8101906121ba565b978c610587565b90506020813d602011610732575b8161071b60209383611f80565b8101031261021c5761072c90612102565b8b610535565b3d915061070e565b50505062ffffff61076c6001600160a01b03926101803d61018011610783575b6107648183611f80565b810190612b73565b5050505050505093509491509390508392506104cd565b503d61075a565b90506020813d6020116107b4575b816107a560209383611f80565b8101031261021c575189610497565b3d9150610798565b9092506020813d6020116107e8575b816107d860209383611f80565b8101031261021c5751918561041a565b3d91506107cb565b3461021c57602036600319011261021c5761025e6103a661080f611d64565b6131cf565b3461021c57600036600319011261021c5760206001600160a01b0360045416604051908152f35b3461021c57608036600319011261021c5767ffffffffffffffff60243581811161021c5761086d903690600401611fba565b906044359080821161021c573660238301121561021c57816004013561089281611fa2565b926108a06040519485611f80565b8184526024602085019260051b8201019136831161021c5760248201905b838210610b615785876108d2606435612ae0565b916000906000916001600160a01b0360005460101c16925b8451811015610b4b576001600160a01b0361090582876120d8565b5160405163b9a09fd560e01b815291166004820152602081602481885afa80156106ba57600090610b0b575b6001600160a01b039150168061094b575b506001016108ea565b949093604051956324f24ba560e11b87526004870152602086602481845afa9586156106ba57600096610acf575b5060005b61098786866120d8565b5151811015610ac3576109e760206001600160a01b036109b1846109ab8b8b6120d8565b516120d8565b511660405180938192633e491d4760e01b83526004359060048401602090939291936001600160a01b0360408201951681520152565b03816001600160a01b038c165afa9081156106ba57600091610a91575b5080610a14575b5060010161097d565b9390610a7d6001926001600160a01b03610a2e8a886120d8565b5116966001600160a01b03610a47856109ab8d8d6120d8565b511660405198610a568a611f48565b895260208901526040880152610a6b81612c20565b96610a76828d6120d8565b528a6120d8565b50610a8b6064358610613183565b90610a0b565b90506020813d602011610abb575b81610aac60209383611f80565b8101031261021c575189610a04565b3d9150610a9f565b50909450926001610942565b9095506020813d602011610b03575b81610aeb60209383611f80565b8101031261021c57610afc90612102565b9487610979565b3d9150610ade565b506020813d602011610b43575b81610b2560209383611f80565b8101031261021c57610b3e6001600160a01b0391612102565b610931565b3d9150610b18565b6040516020808252819061025e9082018961202a565b813585811161021c57602091610b7e839260243691880101611fba565b8152019101906108be565b3461021c57606036600319011261021c57610ba2611d64565b60243567ffffffffffffffff811161021c57610bc2903690600401611fba565b90610bce604435612ae0565b6000916000936001600160a01b0360005460101c16945b8151811015610de2576001600160a01b03610c0082846120d8565b5160405163b9a09fd560e01b8152911660048201526020816024818a5afa9081156106ba57600091610da8575b506001600160a01b038116610c46575b50600101610be5565b604051632000ed8560e21b81526000816004816001600160a01b0386165afa9081156106ba57600091610d8d575b5080519060005b828110610c8a57505050610c3d565b6001600160a01b03610c9c86846120d8565b5160405163211dc32d60e01b815291166001600160a01b0381811660048401528916602483015290602081806044810103816001600160a01b038a165afa9081156106ba57600091610d5b575b5080610cfa575b5050600101610c7b565b600192919a610d46916001600160a01b03610d158a8c6120d8565b51169c60206040519e8f90610d2982611f48565b8152015260408d0152610d3b81612c20565b9b610a76828d6120d8565b50610d546044358b10613183565b908b610cf0565b90506020813d602011610d85575b81610d7660209383611f80565b8101031261021c57518c610ce9565b3d9150610d69565b610da291503d806000833e6106f18183611f80565b88610c74565b90506020813d602011610dda575b81610dc360209383611f80565b8101031261021c57610dd490612102565b87610c2d565b3d9150610db6565b6040516020808252819061025e9082018761202a565b3461021c57608036600319011261021c57610e11611d64565b60443567ffffffffffffffff80821161021c573660238301121561021c57816004013590811161021c573660248260051b8401011161021c57610e5f92602460643593019060243590612c45565b61025e60a05191929160405193849315158452602084015260606040840152606083019061202a565b3461021c57602036600319011261021c5761025e610eac610ea7611d64565b6128ad565b604051918291602083526020830190611ccc565b3461021c57600036600319011261021c5760206001600160a01b0360005460101c16604051908152f35b3461021c57600036600319011261021c5760046001600160a01b0360208160005460101c1660405193848092639647d14160e01b82525afa9081156106ba57600091610f3e575b6020925060405191168152f35b90506020823d602011610f72575b81610f5960209383611f80565b8101031261021c57610f6c602092612102565b90610f31565b3d9150610f4c565b3461021c57600036600319011261021c57610f936124a4565b8051610f9e81612472565b9160005b828110610fb7576040518061025e8682611da6565b6001906001600160a01b03610fd781610fd084876120d8565b5116612431565b90610fe283886120d8565b9116905201610fa2565b3461021c57600036600319011261021c5760206001600160a01b0360055416604051908152f35b3461021c57602036600319011261021c576020611036611031611d64565b612863565b6001600160a01b0360405191168152f35b3461021c57602036600319011261021c5760043567ffffffffffffffff811161021c5761108361107e61025e923690600401611fba565b6127ca565b60405191829182611e96565b3461021c576110d660206110a236611e61565b604051633e491d4760e01b81526001600160a01b039182166004820152602481019390935291938492839182906044820190565b0392165afa80156106ba576000906110f4575b602090604051908152f35b506020813d60201161111f575b8161110e60209383611f80565b8101031261021c57602090516110e9565b3d9150611101565b3461021c57600036600319011261021c5760405161114481611f2c565b60008152600060a0602092828482015282604082015282606082015282608082015201526001600160a01b03908160005460101c1660405191638dd598fb60e01b83528083600481855afa9283156106ba5760009361122d575b60c06111d9868681878188816111b2612185565b936111bb612792565b92826111c5612116565b9660a08280600254169b6040519e8f611f2c565b169c8d815283858201931683526040810195865283606082019816885283608082019a168a5201998a526040519b8c525116908a0152511660408801525116606086015251166080840152511660a0820152f35b939192508084813d831161126a575b6112468183611f80565b8101031261021c57816111d9938161125f60c097612102565b95505092945061119e565b503d61123c565b3461021c57600036600319011261021c5760206001600160a01b0360075416604051908152f35b3461021c5760208060031936011261021c576024816001600160a01b036112bd612723565b166040519283809263d1d58b2560e01b825260043560048301525afa9081156106ba576000916112f1575b50604051908152f35b90508181813d8311611317575b6113088183611f80565b8101031261021c5751826112e8565b503d6112fe565b3461021c57600036600319011261021c576020611036612792565b3461021c57600036600319011261021c576020611036612723565b3461021c57600036600319011261021c5761025e61108361107e6124a4565b3461021c5760e036600319011261021c576004356001600160a01b03808216820361021c576113a0611d7a565b906113a9611d90565b916064359082821680920361021c576084359083821680920361021c5760a43584811680910361021c5760c4359285841680940361021c576000549460ff8660081c161595868097611685575b801561166e575b156116035760ff198116600117600055866115f1575b5075ffffffffffffffffffffffffffffffffffffffff00006000549960101b169680887fffffffffffffffffffff0000000000000000000000000000000000000000ffff8c161780600055817fffffffffffffffffffffffff0000000000000000000000000000000000000000971687600354161760035560101c169860405199638dd598fb60e01b8b5260209a8b81600481855afa9182156106ba57848d926000946115b4575b5060049316896001541617600155604051928380926303aa30b960e11b82525afa80156106ba57839160009161157c575b501686600254161760025516846004541617600455836005541617600555826006541617600655816007541617600755600854161760085561152a57005b7fffffffffffffffffffff000000000000000000000000000000000000000000ff7f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249893161760005560405160018152a1005b8092508c8092503d83116115ad575b6115958183611f80565b8101031261021c576115a78391612102565b8d6114ec565b503d61158b565b92809294508391503d83116115ea575b6115ce8183611f80565b8101031261021c57600491846115e48e93612102565b936114bb565b503d6115c4565b61ffff19166101011760005589611413565b60405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608490fd5b50303b1580156113fd5750600160ff8216146113fd565b50600160ff8216106113f6565b3461021c57600036600319011261021c5760206001600160a01b0360025416604051908152f35b3461021c576116c736611e61565b916001600160a01b0360009216806116e5575b602083604051908152f35b604051633e491d4760e01b81526001600160a01b03909416600485015260248401919091526020915082908180604481015b03915afa80156106ba57600090611734575b6020915082806116da565b506020813d60201161175f575b8161174e60209383611f80565b8101031261021c5760209051611729565b3d9150611741565b3461021c5760208060031936011261021c57611789611784611d64565b6125d7565b906040519181839283018184528251809152816040850193019160005b8281106117b557505050500390f35b8351855286955093810193928101926001016117a6565b3461021c57600036600319011261021c5761025e6103a66124a4565b3461021c57606036600319011261021c57611801611d64565b611809611d7a565b611811611d90565b916001600160a01b03600092168061182e57602083604051908152f35b60405163211dc32d60e01b81526001600160a01b039485166004820152939091166024840152602091508290818060448101611717565b3461021c57602036600319011261021c576020611036611883611d64565b612431565b3461021c57600036600319011261021c5760206001600160a01b0360015416604051908152f35b3461021c57602036600319011261021c5761025e6118d36118ce611d64565b6122b3565b604051918291602083526020830190611deb565b3461021c57600036600319011261021c5760206001600160a01b0360085416604051908152f35b3461021c57602036600319011261021c5761025e6103a661192d611d64565b61223c565b3461021c57600036600319011261021c576020611036612185565b3461021c57600036600319011261021c576020611036612116565b3461021c5760208060031936011261021c57611985611784611d64565b9081519161199283611fa2565b926119a06040519485611f80565b8084526119ac81611fa2565b601f190160005b818110611b6057505060006001926001600160a01b0360015416915b838110611a345750505050604051918083018184528451809152816040850195019160005b828110611a015785870386f35b835180518852828101518389015260408082015190890152606090810151908801526080909601959281019284016119f4565b611a4181839896986120d8565b51611a4c82876120d8565b5152611a5881836120d8565b519060405191635a2d1e0760e11b835260048301526024916040818481885afa9081156106ba57600090600092611b27575b5088611a96848a6120d8565b5101526060611aa583896120d8565b51015286611ab382856120d8565b516040519384916339f890b560e21b8352600483015281875afa80156106ba578892600091611af6575b506040611aea83896120d8565b510152019593956119cf565b809350888092503d8311611b20575b611b0f8183611f80565b8101031261021c5787915189611add565b503d611b05565b9150506040813d604011611b58575b81611b4360409383611f80565b8101031261021c57878151910151908a611a8a565b3d9150611b36565b8490604096949651611b7181611efa565b600081526000838201526000604082015260006060820152828287010152019492946119b3565b3461021c57600036600319011261021c57611bb161320a565b8051611bbc81611fa2565b90611bca6040519283611f80565b808252611bd681611fa2565b60209390601f19018460005b828110611c935750505060005b828110611c58575050506040519082820192808352815180945260408301938160408260051b8601019301916000955b828710611c2c5785850386f35b909192938280611c48600193603f198a82030186528851611ccc565b9601920196019592919092611c1f565b80611c776001600160a01b03611c70600194866120d8565b51166128ad565b611c8182876120d8565b52611c8c81866120d8565b5001611bef565b611c9b612080565b828288010152018590611be2565b60005b838110611cbc5750506000910152565b8181015183820152602001611cac565b906101206001600160a01b039283815116835260208101519382602085015284518093850152611d06836101409660208888019101611ca9565b6040820151151560408501528060608301511660608501528060808301511660808501528060a08301511660a08501528060c08301511660c085015260e08201511660e08401526101008091015190830152601f8019910116010190565b600435906001600160a01b038216820361021c57565b602435906001600160a01b038216820361021c57565b604435906001600160a01b038216820361021c57565b602090602060408183019282815285518094520193019160005b828110611dce575050505090565b83516001600160a01b031685529381019392810192600101611dc0565b60409060408301906001600160a01b038151168452602060608180930151956040838201528651809552019401926000905b838210611e2c57505050505090565b9091929394838282611e546001948a51602080916001600160a01b0381511684520151910152565b0196019493920190611e1d565b606090600319011261021c57600435906001600160a01b0390602435828116810361021c5791604435908116810361021c5790565b6020808201906020835283518092526040830192602060408460051b8301019501936000915b848310611ecc5750505050505090565b9091929394958480611eea600193603f198682030187528a51611deb565b9801930193019194939290611ebc565b6080810190811067ffffffffffffffff821117611f1657604052565b634e487b7160e01b600052604160045260246000fd5b60c0810190811067ffffffffffffffff821117611f1657604052565b6060810190811067ffffffffffffffff821117611f1657604052565b6040810190811067ffffffffffffffff821117611f1657604052565b90601f8019910116810190811067ffffffffffffffff821117611f1657604052565b67ffffffffffffffff8111611f165760051b60200190565b9080601f8301121561021c576020908235611fd481611fa2565b93611fe26040519586611f80565b81855260208086019260051b82010192831161021c57602001905b82821061200b575050505090565b81356001600160a01b038116810361021c578152908301908301611ffd565b90815180825260208080930193019160005b82811061204a575050505090565b835180516001600160a01b039081168752818401511686840152604090810151908601526060909401939281019260010161203c565b60405190610120820182811067ffffffffffffffff821117611f165760405281610100600091828152606060208201528260408201528260608201528260808201528260a08201528260c08201528260e08201520152565b80518210156120ec5760209160051b010190565b634e487b7160e01b600052603260045260246000fd5b51906001600160a01b038216820361021c57565b600460206001600160a01b0360005460101c16604051928380926368c3acb360e01b82525afa9081156106ba5760009161214e575090565b90506020813d60201161217d575b8161216960209383611f80565b8101031261021c5761217a90612102565b90565b3d915061215c565b600460206001600160a01b03600154166040519283809263210ca05d60e01b82525afa9081156106ba5760009161214e575090565b602090818184031261021c5780519067ffffffffffffffff821161021c57019180601f8401121561021c5782516121f081611fa2565b936121fe6040519586611f80565b818552838086019260051b82010192831161021c578301905b828210612225575050505090565b83809161223184612102565b815201910190612217565b61224d6001600160a01b0391612431565b16801561229357600060049160405192838092632000ed8560e21b82525afa9081156106ba5760009161227e575090565b61217a91503d806000833e6106f18183611f80565b50606090565b604051906122a682611f64565b6060602083600081520152565b906122bc612299565b916001600160a01b0390816122d082612431565b1690811561242c576122e19061223c565b8051906122ed82611fa2565b936040916122fd83519687611f80565b838652601f1961230c85611fa2565b0160005b81811061240857505060005b84811061233157505050505083526020830152565b8261233c82846120d8565b511661234882896120d8565b51528261235582846120d8565b51855163091cbb3f60e31b8152911660048201526080919082816024818b5afa9081156123fd5760009161239f575b5060019250516020612396838b6120d8565b5101520161231c565b919282813d83116123f6575b6123b58183611f80565b810103126123f357508451600192916123cd82611efa565b805182526020808201519083015286810151878301526060809101519082015238612384565b80fd5b503d6123ab565b86513d6000823e3d90fd5b602090855161241681611f64565b6000815282600081830152828b01015201612310565b505050565b60206001600160a01b0360248160005460101c1693604051948593849263b9a09fd560e01b84521660048301525afa9081156106ba5760009161214e575090565b9061247c82611fa2565b6124896040519182611f80565b828152809261249a601f1991611fa2565b0190602036910137565b6001600160a01b039060009180835460101c169060409060405192630fbdb69960e11b84526020956004968086600481865afa9586156125cc578296612599575b506124ef86612472565b97825b878110612503575050505050505050565b86516315895f4760e31b81528281018290528381602481895afa90811561258f5790878c93928792612547575b5061253d836001956120d8565b91169052016124f2565b92935050508381813d8311612588575b6125618183611f80565b8101031261258457908a8761253d8361257b600196612102565b93955050612530565b8480fd5b503d612557565b88513d87823e3d90fd5b9080965081813d83116125c5575b6125b18183611f80565b810103126125c1575194386124e5565b5080fd5b503d6125a7565b6040513d84823e3d90fd5b906001600160a01b039160019083600154169060408051926370a0823160e01b8452600496831660048501526020908185602481845afa9485156106ba576000956126f4575b5061262785611fa2565b936126356040519586611f80565b858552601f1961264487611fa2565b013684870137849860005b87811061266157505050505050505050565b8551632f745c5960e01b81526001600160a01b038416838201908152602081018390528690829081906040010381885afa9081156126e957908a92916000916126b7575b506126b0828a6120d8565b520161264f565b9192508682813d83116126e2575b6126cf8183611f80565b810103126123f3575090899151386126a5565b503d6126c5565b87513d6000823e3d90fd5b90948282813d831161271c575b61270b8183611f80565b810103126123f3575051933861261d565b503d612701565b6001600160a01b036004602082600254166040519283809262fca95560e61b82525afa9081156106ba5760009161275957501690565b6020813d60201161278a575b8161277260209383611f80565b810103126125c157519082821682036123f357501690565b3d9150612765565b600460206001600160a01b0360005460101c166040519283809263c45a015560e01b82525afa9081156106ba5760009161214e575090565b9081516127d681611fa2565b6127e36040519182611f80565b818152601f196127f283611fa2565b0160005b81811061284c575050809360005b8381106128115750505050565b806128306001600160a01b03612829600194866120d8565b51166122b3565b61283a82866120d8565b5261284581856120d8565b5001612804565b602090612857612299565b828286010152016127f6565b61286c90612431565b60206001600160a01b0360248160005460101c169360405194859384926324f24ba560e11b84521660048301525afa9081156106ba5760009161214e575090565b906128b6612080565b6001600160a01b03808416808352604080516395d89b4160e01b81529395929160008086600481855afa958615612ad4578196612a30575b5060209586890152825191634eb1c24560e11b83528383600481845afa928315612a265790858892849085966129d4575b50816004961660808d01521660608b01528561293a88612431565b1660a08b01528561294a88612863565b1660c08b01528451634d78e9ad60e11b815293849182905afa9283156129ca5750809261298c575b505061298493501660e0850152613313565b610100830152565b915091929382813d83116129c3575b6129a58183611f80565b810103126123f35750906129bc6129849392612102565b3880612972565b503d61299b565b51903d90823e3d90fd5b935050509192508381813d8311612a1f575b6129f08183611f80565b81010312612a1b5760049291858281612a148b612a0d8197612102565b9301612102565b965061291f565b8280fd5b503d6129e6565b84513d84823e3d90fd5b9095503d8087833e612a428183611f80565b810190602081830312612ad057805167ffffffffffffffff91828211612acc570182601f82011215612ab4578051918211612ab857845192612a8e601f8401601f191660200185611f80565b82845260208383010111612ab45790612aad9160208085019101611ca9565b94386128ee565b8780fd5b634e487b7160e01b88526041600452602488fd5b8880fd5b8680fd5b508251903d90823e3d90fd5b90612aea82611fa2565b604090612afa6040519182611f80565b8381528093612b0b601f1991611fa2565b019160009160005b848110612b21575050505050565b6020908351612b2f81611f48565b8581528286818301528686830152828501015201612b13565b51908160020b820361021c57565b51906fffffffffffffffffffffffffffffffff8216820361021c57565b91908261018091031261021c5781516bffffffffffffffffffffffff8116810361021c5791612ba460208201612102565b91612bb160408301612102565b91612bbe60608201612102565b91608082015162ffffff8116810361021c5791612bdd60a08201612b48565b91612bea60c08301612b48565b91612bf760e08201612b56565b91610100820151916101208101519161217a610160612c196101408501612b56565b9301612b56565b6000198114612c2f5760010190565b634e487b7160e01b600052601160045260246000fd5b92939190600060a052600094612c5a84612ae0565b60a0526000926001600160a01b036005541695604051936370a0823160e01b85526001600160a01b03821660048601526020856024818b5afa9485156106ba5760009561314f575b50969396936001600160a01b0360045416916001600160a01b0360005460101c16955b898110612cdb5750505050505050505050600191565b604051632f745c5960e01b81526001600160a01b038316600482015260248101829052602081604481875afa9081156106ba5760009161311d575b5060405163133f757160e31b81526004810182905261018081602481885afa9081156106ba57612d7f91600090600080916130dd575b62ffffff9293506001600160a01b03908160405195612d6a87611f48565b168552166020840152166040820152866134ee565b60405163b9a09fd560e01b81526001600160a01b03821660048201526020816024818d5afa80156106ba57600060c0526130a2575b506001600160a01b0360c05116612dd0575b5050600101612cc5565b979295909b9460009d9b9497929d5082151560001461305057612df283612472565b976000805b858110612f855750612e0881612472565b9960005b828110612f5c575050505b60005b8951811015612f4457612e3c8f6020906001600160a01b036105ac858f6120d8565b03816001600160a01b0360c051165afa9081156106ba57600091612f12575b50620f42405a10612efd5780612e75575b50600101612e1a565b6001600160a01b03612e87838d6120d8565b5116604051608052612e9a608051611f48565b6001600160a01b038d16608051526020608051015260406080510152612edb612ec28d612c20565b9c608051612ed28260a0516120d8565b5260a0516120d8565b508c8c14612ee95738612e6c565b5060009e9d50505050505050505050505050565b5060009f9e5050505050505050505050505050565b90506020813d602011612f3c575b81612f2d60209383611f80565b8101031261021c575138612e5b565b3d9150612f20565b50949b9d9196939850949b5060019196509038612dc6565b808c612f7e826001600160a01b03612f76600196886120d8565b5116926120d8565b5201612e0c565b908160051b8501356001600160a01b038116810361021c576040516309ab9c0760e31b81526001600160a01b03821660048201526020816024816001600160a01b0360c051165afa9081156106ba57600091613015575b50612fec575b5090600101612df7565b6001600160a01b0316612fff828d6120d8565b52600181018111612c2f57600180910190612fe2565b90506020813d602011613048575b8161303060209383611f80565b8101031261021c5751801515810361021c5738612fdc565b3d9150613023565b60405163c4f59f9b60e01b81526000816004816001600160a01b0360c051165afa9081156106ba57600091613087575b5097612e17565b61309c91503d806000833e6106f18183611f80565b38613080565b6020813d6020116130d5575b816130bb60209383611f80565b8101031261021c576130cc90612102565b60c05238612db4565b3d91506130ae565b50505062ffffff6131066001600160a01b03926101803d61018011610783576107648183611f80565b505050505050509350949150939050839250612d4c565b90506020813d602011613147575b8161313860209383611f80565b8101031261021c575138612d16565b3d915061312b565b9094506020813d60201161317b575b8161316b60209383611f80565b8101031261021c57519338612ca2565b3d915061315e565b1561318a57565b60405162461bcd60e51b815260206004820152601260248201527f496e637265617365206d617852657475726e00000000000000000000000000006044820152606490fd5b60006001600160a01b036131e4600493612863565b166040519283809263c4f59f9b60e01b82525afa9081156106ba5760009161227e575090565b6001600160a01b03908161321c612792565b1691604080519163574f2ba360e01b83526020946004958085600481855afa9485156106ba576000956132e4575b5061325485612472565b9660005b8681106132685750505050505050565b8551631e3dd18b60e01b81528281018290528381602481885afa9081156126e9576000916132ab575b5090600191866132a1838d6120d8565b9116905201613258565b908482813d83116132dd575b6132c18183611f80565b810103126123f35750906132d6600192612102565b9091613291565b503d6132b7565b9080955081813d831161330c575b6132fc8183611f80565b8101031261021c5751933861324a565b503d6132f2565b60206001600160a01b03602481613328612792565b1693604051948593849263841fa66b60e01b84521660048301525afa9081156106ba57600091613356575090565b90506020813d60201161337d575b8161337160209383611f80565b8101031261021c575190565b3d9150613364565b919091613390612299565b926001600160a01b0391826133a483612863565b169182156134e8576133b5906131cf565b908151928087526133c584611fa2565b946040936133d66040519788611f80565b858752601f196133e587611fa2565b0160005b8181106134c457505060005b86811061340a57505050505050506020830152565b8261341582846120d8565b5116613421828a6120d8565b51528261342e82846120d8565b518751633e491d4760e01b815291166001600160a01b0316600482015260248101869052906020808380604481010381895afa9081156134b957600091613487575b6001935061347e838c6120d8565b510152016133f5565b9192908282813d83116134b2575b61349f8183611f80565b810103126123f357505160019291613470565b503d613495565b88513d6000823e3d90fd5b60209087516134d281611f64565b6000815282600081830152828c010152016133e9565b50505050565b6001600160a01b0391828151169083602082015116908183101561021c57604062ffffff910151166040519160208301938452604083015260608201526060815261353881611efa565b51902060405190602082019260ff60f81b84526bffffffffffffffffffffffff199060601b16602183015260358201527f1565b129f2d1790f12d45301b9b084335626f0c92410bc43130763b69971135d60558201526055815261359b81611efa565b519020169056fea164736f6c6343000817000a

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

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.