FRAX Price: $0.98 (+1.42%)

Contract

0x3f8C3e32E1d05B13A45Eb334B9a443Dbff41cd6a

Overview

FRAX Balance | FXTL Balance

0 FRAX | 18,260 FXTL

FRAX Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To
Get Reward312300882026-01-24 16:08:072 hrs ago1769270887IN
0x3f8C3e32...bff41cd6a
0 FRAX0.000018180.00010025
Get Reward312236732026-01-24 12:34:175 hrs ago1769258057IN
0x3f8C3e32...bff41cd6a
0 FRAX0.000003770.00010025
Get Reward312173472026-01-24 9:03:259 hrs ago1769245405IN
0x3f8C3e32...bff41cd6a
0 FRAX0.000002920.00010025
Get Reward312105632026-01-24 5:17:1713 hrs ago1769231837IN
0x3f8C3e32...bff41cd6a
0 FRAX0.000003160.00010025
Withdraw312105292026-01-24 5:16:0913 hrs ago1769231769IN
0x3f8C3e32...bff41cd6a
0 FRAX0.000003060.00010025
Withdraw312105212026-01-24 5:15:5313 hrs ago1769231753IN
0x3f8C3e32...bff41cd6a
0 FRAX0.000003030.00010025
Get Reward311818602026-01-23 13:20:3129 hrs ago1769174431IN
0x3f8C3e32...bff41cd6a
0 FRAX0.000007530.00010025
Get Reward311818542026-01-23 13:20:1929 hrs ago1769174419IN
0x3f8C3e32...bff41cd6a
0 FRAX0.000007860.00010025
Deposit311433022026-01-22 15:55:152 days ago1769097315IN
0x3f8C3e32...bff41cd6a
0 FRAX0.000037120.00010025
Deposit311357222026-01-22 11:42:352 days ago1769082155IN
0x3f8C3e32...bff41cd6a
0 FRAX0.000018980.0009797
Get Reward311355862026-01-22 11:38:032 days ago1769081883IN
0x3f8C3e32...bff41cd6a
0 FRAX0.000008760.00010025
Get Reward311291022026-01-22 8:01:552 days ago1769068915IN
0x3f8C3e32...bff41cd6a
0 FRAX0.000004890.00010025
Deposit310592082026-01-20 17:12:074 days ago1768929127IN
0x3f8C3e32...bff41cd6a
0 FRAX0.000023620.00010025
Withdraw310590142026-01-20 17:05:394 days ago1768928739IN
0x3f8C3e32...bff41cd6a
0 FRAX0.000028990.00010025
Deposit310377712026-01-20 5:17:334 days ago1768886253IN
0x3f8C3e32...bff41cd6a
0 FRAX0.000004460.00010026
Withdraw310376602026-01-20 5:13:514 days ago1768886031IN
0x3f8C3e32...bff41cd6a
0 FRAX0.000004470.00010025
Deposit310118332026-01-19 14:52:575 days ago1768834377IN
0x3f8C3e32...bff41cd6a
0 FRAX0.000005190.00010025
Withdraw310117412026-01-19 14:49:535 days ago1768834193IN
0x3f8C3e32...bff41cd6a
0 FRAX0.00000530.00010027
Deposit309682262026-01-18 14:39:236 days ago1768747163IN
0x3f8C3e32...bff41cd6a
0 FRAX0.000002530.00010025
Withdraw309681692026-01-18 14:37:296 days ago1768747049IN
0x3f8C3e32...bff41cd6a
0 FRAX0.000002490.00010025
Deposit309372852026-01-17 21:28:016 days ago1768685281IN
0x3f8C3e32...bff41cd6a
0 FRAX0.000002630.00010025
Withdraw309372072026-01-17 21:25:256 days ago1768685125IN
0x3f8C3e32...bff41cd6a
0 FRAX0.000002680.00010025
Deposit309093562026-01-17 5:57:037 days ago1768629423IN
0x3f8C3e32...bff41cd6a
0 FRAX0.00000260.00010025
Withdraw309087092026-01-17 5:35:297 days ago1768628129IN
0x3f8C3e32...bff41cd6a
0 FRAX0.000002690.00010025
Deposit308985772026-01-16 23:57:457 days ago1768607865IN
0x3f8C3e32...bff41cd6a
0 FRAX0.00000270.00010025
View all transactions

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Block From To
126151442024-11-19 18:29:59430 days ago1732040999  Contract Creation0 FRAX

Cross-Chain Transactions
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x9dDD4EBd...91d474c83
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
LeafCLGauge

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 200 runs

Other Settings:
istanbul EvmVersion

Contract Source Code (Solidity Standard Json-Input format)

// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.7.6;
pragma abicoder v2;

import {SafeCast} from "@openzeppelin/contracts/utils/SafeCast.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/ERC721Holder.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import {ILeafCLGauge} from "contracts/gauge/interfaces/ILeafCLGauge.sol";
import {IVoter} from "contracts/core/interfaces/IVoter.sol";
import {ICLPool} from "contracts/gauge/interfaces/ICLPool.sol";
import {INonfungiblePositionManager} from "contracts/gauge/interfaces/INonfungiblePositionManager.sol";
import {EnumerableSet} from "contracts/libraries/EnumerableSet.sol";
import {FullMath} from "contracts/core/libraries/FullMath.sol";
import {VelodromeTimeLibrary} from "contracts/libraries/VelodromeTimeLibrary.sol";
import {IReward} from "contracts/gauge/interfaces/IReward.sol";
import {ILeafMessageBridge} from "contracts/superchain/ILeafMessageBridge.sol";

/*

██╗   ██╗███████╗██╗      ██████╗ ██████╗ ██████╗  ██████╗ ███╗   ███╗███████╗
██║   ██║██╔════╝██║     ██╔═══██╗██╔══██╗██╔══██╗██╔═══██╗████╗ ████║██╔════╝
██║   ██║█████╗  ██║     ██║   ██║██║  ██║██████╔╝██║   ██║██╔████╔██║█████╗
╚██╗ ██╔╝██╔══╝  ██║     ██║   ██║██║  ██║██╔══██╗██║   ██║██║╚██╔╝██║██╔══╝
 ╚████╔╝ ███████╗███████╗╚██████╔╝██████╔╝██║  ██║╚██████╔╝██║ ╚═╝ ██║███████╗
  ╚═══╝  ╚══════╝╚══════╝ ╚═════╝ ╚═════╝ ╚═╝  ╚═╝ ╚═════╝ ╚═╝     ╚═╝╚══════╝

███████╗██╗   ██╗██████╗ ███████╗██████╗  ██████╗██╗  ██╗ █████╗ ██╗███╗   ██╗
██╔════╝██║   ██║██╔══██╗██╔════╝██╔══██╗██╔════╝██║  ██║██╔══██╗██║████╗  ██║
███████╗██║   ██║██████╔╝█████╗  ██████╔╝██║     ███████║███████║██║██╔██╗ ██║
╚════██║██║   ██║██╔═══╝ ██╔══╝  ██╔══██╗██║     ██╔══██║██╔══██║██║██║╚██╗██║
███████║╚██████╔╝██║     ███████╗██║  ██║╚██████╗██║  ██║██║  ██║██║██║ ╚████║
╚══════╝ ╚═════╝ ╚═╝     ╚══════╝╚═╝  ╚═╝ ╚═════╝╚═╝  ╚═╝╚═╝  ╚═╝╚═╝╚═╝  ╚═══╝

██╗     ███████╗ █████╗ ███████╗ ██████╗██╗      ██████╗  █████╗ ██╗   ██╗ ██████╗ ███████╗
██║     ██╔════╝██╔══██╗██╔════╝██╔════╝██║     ██╔════╝ ██╔══██╗██║   ██║██╔════╝ ██╔════╝
██║     █████╗  ███████║█████╗  ██║     ██║     ██║  ███╗███████║██║   ██║██║  ███╗█████╗
██║     ██╔══╝  ██╔══██║██╔══╝  ██║     ██║     ██║   ██║██╔══██║██║   ██║██║   ██║██╔══╝
███████╗███████╗██║  ██║██║     ╚██████╗███████╗╚██████╔╝██║  ██║╚██████╔╝╚██████╔╝███████╗
╚══════╝╚══════╝╚═╝  ╚═╝╚═╝      ╚═════╝╚══════╝ ╚═════╝ ╚═╝  ╚═╝ ╚═════╝  ╚═════╝ ╚══════╝

*/

/// @title Velodrome Superchain Leaf CL Gauge Contracts
/// @notice Leaf gauge contract for distribution of emissions by address
contract LeafCLGauge is ILeafCLGauge, ERC721Holder, ReentrancyGuard {
    using EnumerableSet for EnumerableSet.UintSet;
    using SafeERC20 for IERC20;
    using SafeCast for uint128;
    using SafeCast for uint256;
    using SafeCast for int256;

    uint256 internal constant Q128 = 0x100000000000000000000000000000000;

    /// @inheritdoc ILeafCLGauge
    INonfungiblePositionManager public immutable override nft;
    /// @inheritdoc ILeafCLGauge
    IVoter public immutable override voter;
    /// @inheritdoc ILeafCLGauge
    ICLPool public immutable override pool;

    /// @inheritdoc ILeafCLGauge
    address public immutable override bridge;

    /// @inheritdoc ILeafCLGauge
    address public immutable override feesVotingReward;
    /// @inheritdoc ILeafCLGauge
    address public immutable override rewardToken;

    /// @inheritdoc ILeafCLGauge
    uint256 public override periodFinish;
    /// @inheritdoc ILeafCLGauge
    uint256 public override rewardRate;

    mapping(uint256 => uint256) public override rewardRateByEpoch; // epochStart => rewardRate
    /// @dev The set of all staked nfts for a given address
    mapping(address => EnumerableSet.UintSet) internal _stakes;
    /// @inheritdoc ILeafCLGauge
    mapping(uint256 => uint256) public override rewardGrowthInside;

    /// @inheritdoc ILeafCLGauge
    mapping(uint256 => uint256) public override rewards;
    /// @inheritdoc ILeafCLGauge
    mapping(uint256 => uint256) public override lastUpdateTime;

    /// @inheritdoc ILeafCLGauge
    uint256 public override fees0;
    /// @inheritdoc ILeafCLGauge
    uint256 public override fees1;
    /// @inheritdoc ILeafCLGauge
    address public immutable override token0;
    /// @inheritdoc ILeafCLGauge
    address public immutable override token1;
    /// @inheritdoc ILeafCLGauge
    int24 public immutable override tickSpacing;

    bool public immutable override isPool;

    constructor(
        address _pool,
        address _token0,
        address _token1,
        int24 _tickSpacing,
        address _feesVotingReward,
        address _rewardToken,
        address _voter,
        address _nft,
        address _bridge,
        bool _isPool
    ) {
        pool = ICLPool(_pool);
        token0 = _token0;
        token1 = _token1;
        tickSpacing = _tickSpacing;
        feesVotingReward = _feesVotingReward;
        rewardToken = _rewardToken;
        voter = IVoter(_voter);
        nft = INonfungiblePositionManager(_nft);
        bridge = _bridge;
        isPool = _isPool;
    }

    // updates the claimable rewards and lastUpdateTime for tokenId
    function _updateRewards(uint256 tokenId, int24 tickLower, int24 tickUpper) internal {
        if (lastUpdateTime[tokenId] == block.timestamp) return;
        pool.updateRewardsGrowthGlobal();
        lastUpdateTime[tokenId] = block.timestamp;
        rewards[tokenId] += _earned(tokenId);
        rewardGrowthInside[tokenId] = pool.getRewardGrowthInside(tickLower, tickUpper, 0);
    }

    /// @inheritdoc ILeafCLGauge
    function earned(address account, uint256 tokenId) external view override returns (uint256) {
        require(_stakes[account].contains(tokenId), "NA");

        return _earned(tokenId);
    }

    function _earned(uint256 tokenId) internal view returns (uint256) {
        uint256 lastUpdated = pool.lastUpdated();

        uint256 timeDelta = block.timestamp - lastUpdated;

        uint256 rewardGrowthGlobalX128 = pool.rewardGrowthGlobalX128();
        uint256 rewardReserve = pool.rewardReserve();

        if (timeDelta != 0 && rewardReserve > 0 && pool.stakedLiquidity() > 0) {
            uint256 reward = rewardRate * timeDelta;
            if (reward > rewardReserve) reward = rewardReserve;

            rewardGrowthGlobalX128 += FullMath.mulDiv(reward, Q128, pool.stakedLiquidity());
        }

        (,,,,, int24 tickLower, int24 tickUpper, uint128 liquidity,,,,) = nft.positions(tokenId);

        uint256 rewardPerTokenInsideInitialX128 = rewardGrowthInside[tokenId];
        uint256 rewardPerTokenInsideX128 = pool.getRewardGrowthInside(tickLower, tickUpper, rewardGrowthGlobalX128);

        uint256 claimable = FullMath.mulDiv(rewardPerTokenInsideX128 - rewardPerTokenInsideInitialX128, liquidity, Q128);
        return claimable;
    }

    /// @inheritdoc ILeafCLGauge
    function getReward(address account) external override nonReentrant {
        require(msg.sender == address(voter), "NV");

        uint256[] memory tokenIds = _stakes[account].values();
        uint256 length = tokenIds.length;
        uint256 tokenId;
        int24 tickLower;
        int24 tickUpper;
        for (uint256 i = 0; i < length; i++) {
            tokenId = tokenIds[i];
            (,,,,, tickLower, tickUpper,,,,,) = nft.positions(tokenId);
            _getReward(tickLower, tickUpper, tokenId, account);
        }
    }

    /// @inheritdoc ILeafCLGauge
    function getReward(uint256 tokenId) external override nonReentrant {
        require(_stakes[msg.sender].contains(tokenId), "NA");

        (,,,,, int24 tickLower, int24 tickUpper,,,,,) = nft.positions(tokenId);
        _getReward(tickLower, tickUpper, tokenId, msg.sender);
    }

    function _getReward(int24 tickLower, int24 tickUpper, uint256 tokenId, address owner) internal {
        _updateRewards(tokenId, tickLower, tickUpper);

        uint256 reward = rewards[tokenId];

        if (reward > 0) {
            delete rewards[tokenId];
            IERC20(rewardToken).safeTransfer(owner, reward);
            emit ClaimRewards(owner, reward);
        }
    }

    /// @inheritdoc ILeafCLGauge
    function deposit(uint256 tokenId) external override nonReentrant {
        require(nft.ownerOf(tokenId) == msg.sender, "NA");
        require(voter.isAlive(address(this)), "GK");
        (,, address _token0, address _token1, int24 _tickSpacing, int24 tickLower, int24 tickUpper,,,,,) =
            nft.positions(tokenId);
        require(token0 == _token0 && token1 == _token1 && tickSpacing == _tickSpacing, "PM");

        // trigger update on staked position so NFT will be in sync with the pool
        nft.collect(
            INonfungiblePositionManager.CollectParams({
                tokenId: tokenId,
                recipient: msg.sender,
                amount0Max: type(uint128).max,
                amount1Max: type(uint128).max
            })
        );

        nft.safeTransferFrom(msg.sender, address(this), tokenId);
        _stakes[msg.sender].add(tokenId);

        (,,,,,,, uint128 liquidityToStake,,,,) = nft.positions(tokenId);
        pool.stake((uint256(liquidityToStake).toInt256()).toInt128(), tickLower, tickUpper);

        uint256 rewardGrowth = pool.getRewardGrowthInside(tickLower, tickUpper, 0);
        rewardGrowthInside[tokenId] = rewardGrowth;
        lastUpdateTime[tokenId] = block.timestamp;

        emit Deposit(msg.sender, tokenId, liquidityToStake);
    }

    /// @inheritdoc ILeafCLGauge
    function withdraw(uint256 tokenId) external override nonReentrant {
        require(_stakes[msg.sender].contains(tokenId), "NA");

        // trigger update on staked position so NFT will be in sync with the pool
        nft.collect(
            INonfungiblePositionManager.CollectParams({
                tokenId: tokenId,
                recipient: msg.sender,
                amount0Max: type(uint128).max,
                amount1Max: type(uint128).max
            })
        );

        (,,,,, int24 tickLower, int24 tickUpper, uint128 liquidityToStake,,,,) = nft.positions(tokenId);
        _getReward(tickLower, tickUpper, tokenId, msg.sender);

        pool.stake(-(uint256(liquidityToStake).toInt256()).toInt128(), tickLower, tickUpper);

        _stakes[msg.sender].remove(tokenId);
        nft.safeTransferFrom(address(this), msg.sender, tokenId);

        emit Withdraw(msg.sender, tokenId, liquidityToStake);
    }

    /// @inheritdoc ILeafCLGauge
    function stakedValues(address depositor) external view override returns (uint256[] memory staked) {
        uint256 length = _stakes[depositor].length();
        staked = new uint256[](length);
        for (uint256 i = 0; i < length; i++) {
            staked[i] = _stakes[depositor].at(i);
        }
    }

    /// @inheritdoc ILeafCLGauge
    function stakedByIndex(address depositor, uint256 index) external view override returns (uint256) {
        return _stakes[depositor].at(index);
    }

    /// @inheritdoc ILeafCLGauge
    function stakedContains(address depositor, uint256 tokenId) external view override returns (bool) {
        return _stakes[depositor].contains(tokenId);
    }

    /// @inheritdoc ILeafCLGauge
    function stakedLength(address depositor) external view override returns (uint256) {
        return _stakes[depositor].length();
    }

    function left() external view override returns (uint256) {
        if (block.timestamp >= periodFinish) return 0;
        uint256 _remaining = periodFinish - block.timestamp;
        return _remaining * rewardRate;
    }

    /// @inheritdoc ILeafCLGauge
    function notifyRewardAmount(uint256 _amount) external override nonReentrant {
        address sender = msg.sender;
        require(sender == ILeafMessageBridge(bridge).module(), "NM");
        require(_amount != 0, "ZR");
        _claimFees();
        _notifyRewardAmount(sender, _amount);
    }

    /// @inheritdoc ILeafCLGauge
    function notifyRewardWithoutClaim(uint256 _amount) external override nonReentrant {
        address sender = msg.sender;
        require(sender == ILeafMessageBridge(bridge).module(), "NM");
        require(_amount != 0, "ZR");
        _notifyRewardAmount(sender, _amount);
    }

    function _notifyRewardAmount(address _sender, uint256 _amount) internal {
        uint256 timestamp = block.timestamp;
        uint256 timeUntilNext = VelodromeTimeLibrary.epochNext(timestamp) - timestamp;
        pool.updateRewardsGrowthGlobal();
        uint256 nextPeriodFinish = timestamp + timeUntilNext;

        IERC20(rewardToken).safeTransferFrom(_sender, address(this), _amount);
        // rolling over stuck rewards from previous epoch (if any)
        _amount += pool.rollover();

        if (timestamp >= periodFinish) {
            rewardRate = _amount / timeUntilNext;
            pool.syncReward({rewardRate: rewardRate, rewardReserve: _amount, periodFinish: nextPeriodFinish});
        } else {
            uint256 _leftover = timeUntilNext * rewardRate;
            rewardRate = (_amount + _leftover) / timeUntilNext;
            pool.syncReward({rewardRate: rewardRate, rewardReserve: _amount + _leftover, periodFinish: nextPeriodFinish});
        }
        rewardRateByEpoch[VelodromeTimeLibrary.epochStart(timestamp)] = rewardRate;
        require(rewardRate != 0, "ZRR");

        // Ensure the provided reward amount is not more than the balance in the contract.
        // This keeps the reward rate in the right range
        uint256 balance = IERC20(rewardToken).balanceOf(address(this));
        require(rewardRate <= balance / timeUntilNext, "RRH");

        periodFinish = nextPeriodFinish;
        emit NotifyReward(_sender, _amount);
    }

    function _claimFees() internal {
        if (!isPool) return;

        (uint256 claimed0, uint256 claimed1) = pool.collectFees();
        if (claimed0 > 0 || claimed1 > 0) {
            uint256 _fees0 = fees0 + claimed0;
            uint256 _fees1 = fees1 + claimed1;
            address _token0 = token0;
            address _token1 = token1;
            if (_fees0 > VelodromeTimeLibrary.WEEK) {
                fees0 = 0;
                IERC20(_token0).safeIncreaseAllowance(feesVotingReward, _fees0);
                IReward(feesVotingReward).notifyRewardAmount(_token0, _fees0);
            } else {
                fees0 = _fees0;
            }
            if (_fees1 > VelodromeTimeLibrary.WEEK) {
                fees1 = 0;
                IERC20(_token1).safeIncreaseAllowance(feesVotingReward, _fees1);
                IReward(feesVotingReward).notifyRewardAmount(_token1, _fees1);
            } else {
                fees1 = _fees1;
            }

            emit ClaimFees(msg.sender, claimed0, claimed1);
        }
    }
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;


/**
 * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
 * checks.
 *
 * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
 * easily result in undesired exploitation or bugs, since developers usually
 * assume that overflows raise errors. `SafeCast` restores this intuition by
 * reverting the transaction when such an operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 *
 * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing
 * all math on `uint256` and `int256` and then downcasting.
 */
library SafeCast {

    /**
     * @dev Returns the downcasted uint128 from uint256, reverting on
     * overflow (when the input is greater than largest uint128).
     *
     * Counterpart to Solidity's `uint128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     */
    function toUint128(uint256 value) internal pure returns (uint128) {
        require(value < 2**128, "SafeCast: value doesn\'t fit in 128 bits");
        return uint128(value);
    }

    /**
     * @dev Returns the downcasted uint64 from uint256, reverting on
     * overflow (when the input is greater than largest uint64).
     *
     * Counterpart to Solidity's `uint64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     */
    function toUint64(uint256 value) internal pure returns (uint64) {
        require(value < 2**64, "SafeCast: value doesn\'t fit in 64 bits");
        return uint64(value);
    }

    /**
     * @dev Returns the downcasted uint32 from uint256, reverting on
     * overflow (when the input is greater than largest uint32).
     *
     * Counterpart to Solidity's `uint32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     */
    function toUint32(uint256 value) internal pure returns (uint32) {
        require(value < 2**32, "SafeCast: value doesn\'t fit in 32 bits");
        return uint32(value);
    }

    /**
     * @dev Returns the downcasted uint16 from uint256, reverting on
     * overflow (when the input is greater than largest uint16).
     *
     * Counterpart to Solidity's `uint16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     */
    function toUint16(uint256 value) internal pure returns (uint16) {
        require(value < 2**16, "SafeCast: value doesn\'t fit in 16 bits");
        return uint16(value);
    }

    /**
     * @dev Returns the downcasted uint8 from uint256, reverting on
     * overflow (when the input is greater than largest uint8).
     *
     * Counterpart to Solidity's `uint8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits.
     */
    function toUint8(uint256 value) internal pure returns (uint8) {
        require(value < 2**8, "SafeCast: value doesn\'t fit in 8 bits");
        return uint8(value);
    }

    /**
     * @dev Converts a signed int256 into an unsigned uint256.
     *
     * Requirements:
     *
     * - input must be greater than or equal to 0.
     */
    function toUint256(int256 value) internal pure returns (uint256) {
        require(value >= 0, "SafeCast: value must be positive");
        return uint256(value);
    }

    /**
     * @dev Returns the downcasted int128 from int256, reverting on
     * overflow (when the input is less than smallest int128 or
     * greater than largest int128).
     *
     * Counterpart to Solidity's `int128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     *
     * _Available since v3.1._
     */
    function toInt128(int256 value) internal pure returns (int128) {
        require(value >= -2**127 && value < 2**127, "SafeCast: value doesn\'t fit in 128 bits");
        return int128(value);
    }

    /**
     * @dev Returns the downcasted int64 from int256, reverting on
     * overflow (when the input is less than smallest int64 or
     * greater than largest int64).
     *
     * Counterpart to Solidity's `int64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     *
     * _Available since v3.1._
     */
    function toInt64(int256 value) internal pure returns (int64) {
        require(value >= -2**63 && value < 2**63, "SafeCast: value doesn\'t fit in 64 bits");
        return int64(value);
    }

    /**
     * @dev Returns the downcasted int32 from int256, reverting on
     * overflow (when the input is less than smallest int32 or
     * greater than largest int32).
     *
     * Counterpart to Solidity's `int32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     *
     * _Available since v3.1._
     */
    function toInt32(int256 value) internal pure returns (int32) {
        require(value >= -2**31 && value < 2**31, "SafeCast: value doesn\'t fit in 32 bits");
        return int32(value);
    }

    /**
     * @dev Returns the downcasted int16 from int256, reverting on
     * overflow (when the input is less than smallest int16 or
     * greater than largest int16).
     *
     * Counterpart to Solidity's `int16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     *
     * _Available since v3.1._
     */
    function toInt16(int256 value) internal pure returns (int16) {
        require(value >= -2**15 && value < 2**15, "SafeCast: value doesn\'t fit in 16 bits");
        return int16(value);
    }

    /**
     * @dev Returns the downcasted int8 from int256, reverting on
     * overflow (when the input is less than smallest int8 or
     * greater than largest int8).
     *
     * Counterpart to Solidity's `int8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits.
     *
     * _Available since v3.1._
     */
    function toInt8(int256 value) internal pure returns (int8) {
        require(value >= -2**7 && value < 2**7, "SafeCast: value doesn\'t fit in 8 bits");
        return int8(value);
    }

    /**
     * @dev Converts an unsigned uint256 into a signed int256.
     *
     * Requirements:
     *
     * - input must be less than or equal to maxInt256.
     */
    function toInt256(uint256 value) internal pure returns (int256) {
        require(value < 2**255, "SafeCast: value doesn't fit in an int256");
        return int256(value);
    }
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

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

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

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

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

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

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

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

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

// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

import "./IERC20.sol";
import "../../math/SafeMath.sol";
import "../../utils/Address.sol";

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

    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

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

    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender).add(value);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

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

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) { // Return data is optional
            // solhint-disable-next-line max-line-length
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

import "./IERC721Receiver.sol";

  /**
   * @dev Implementation of the {IERC721Receiver} interface.
   *
   * Accepts all token transfers. 
   * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}.
   */
contract ERC721Holder is IERC721Receiver {

    /**
     * @dev See {IERC721Receiver-onERC721Received}.
     *
     * Always returns `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(address, address, uint256, bytes memory) public virtual override returns (bytes4) {
        return this.onERC721Received.selector;
    }
}

File 6 of 22 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

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

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

    uint256 private _status;

    constructor () {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

        _;

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

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

import {IVoter} from "contracts/core/interfaces/IVoter.sol";
import {ICLPool} from "contracts/gauge/interfaces/ICLPool.sol";
import {INonfungiblePositionManager} from "contracts/gauge/interfaces/INonfungiblePositionManager.sol";

interface ILeafCLGauge {
    event NotifyReward(address indexed from, uint256 amount);
    event Deposit(address indexed user, uint256 indexed tokenId, uint128 indexed liquidityToStake);
    event Withdraw(address indexed user, uint256 indexed tokenId, uint128 indexed liquidityToStake);
    event ClaimFees(address indexed from, uint256 claimed0, uint256 claimed1);
    event ClaimRewards(address indexed from, uint256 amount);

    /// @notice NonfungiblePositionManager used to create nfts this gauge accepts
    function nft() external view returns (INonfungiblePositionManager);

    /// @notice Voter contract gauge receives emissions from
    function voter() external view returns (IVoter);

    /// @notice Address of Velodrome v2 Bridge
    function bridge() external view returns (address);

    /// @notice Address of the CL pool linked to the gauge
    function pool() external view returns (ICLPool);

    /// @notice Address of the FeesVotingReward contract linked to the gauge
    function feesVotingReward() external view returns (address);

    /// @notice Timestamp end of current rewards period
    function periodFinish() external view returns (uint256);

    /// @notice Current reward rate of rewardToken to distribute per second
    function rewardRate() external view returns (uint256);

    /// @notice Claimable rewards by tokenId
    function rewards(uint256 tokenId) external view returns (uint256);

    /// @notice Most recent timestamp tokenId called updateRewards
    function lastUpdateTime(uint256 tokenId) external view returns (uint256);

    /// @notice View to see the rewardRate given the timestamp of the start of the epoch
    function rewardRateByEpoch(uint256) external view returns (uint256);

    /// @notice Cached amount of fees generated from the Pool linked to the Gauge of token0
    function fees0() external view returns (uint256);

    /// @notice Cached amount of fees generated from the Pool linked to the Gauge of token1
    function fees1() external view returns (uint256);

    /// @notice Cached address of token0, corresponding to token0 of the pool
    function token0() external view returns (address);

    /// @notice Cached address of token1, corresponding to token1 of the pool
    function token1() external view returns (address);

    /// @notice Cached tick spacing of the pool.
    function tickSpacing() external view returns (int24);

    /// @notice Total amount of rewardToken to distribute for the current rewards period
    function left() external view returns (uint256 _left);

    /// @notice Address of the emissions token
    function rewardToken() external view returns (address);

    /// @notice To provide compatibility support with the old voter
    function isPool() external view returns (bool);

    /// @notice Returns the rewardGrowthInside of the position at the last user action (deposit, withdraw, getReward)
    /// @param tokenId The tokenId of the position
    /// @return The rewardGrowthInside for the position
    function rewardGrowthInside(uint256 tokenId) external view returns (uint256);

    /// @notice Returns the claimable rewards for a given account and tokenId
    /// @dev Throws if account is not the position owner
    /// @dev pool.updateRewardsGrowthGlobal() needs to be called first, to return the correct claimable rewards
    /// @param account The address of the user
    /// @param tokenId The tokenId of the position
    /// @return The amount of claimable reward
    function earned(address account, uint256 tokenId) external view returns (uint256);

    /// @notice Retrieve rewards for all tokens owned by an account
    /// @dev Throws if not called by the voter
    /// @param account The account of the user
    function getReward(address account) external;

    /// @notice Retrieve rewards for a tokenId
    /// @dev Throws if not called by the position owner
    /// @param tokenId The tokenId of the position
    function getReward(uint256 tokenId) external;

    /// @notice Notifies gauge of gauge rewards.
    /// @param amount Amount of gauge rewards (emissions) to notify. Must be greater than 604_800.
    function notifyRewardAmount(uint256 amount) external;

    /// @dev Notifies gauge of gauge rewards without distributing its fees.
    ///      Assumes gauge reward tokens is 18 decimals.
    ///      If not 18 decimals, rewardRate may have rounding issues.
    /// @param amount Amount of gauge rewards (emissions) to notify. Must be greater than 604_800.
    function notifyRewardWithoutClaim(uint256 amount) external;

    /// @notice Used to deposit a CL position into the gauge
    /// @notice Allows the user to receive emissions instead of fees
    /// @param tokenId The tokenId of the position
    function deposit(uint256 tokenId) external;

    /// @notice Used to withdraw a CL position from the gauge
    /// @notice Allows the user to receive fees instead of emissions
    /// @notice Outstanding emissions will be collected on withdrawal
    /// @param tokenId The tokenId of the position
    function withdraw(uint256 tokenId) external;

    /// @notice Fetch all tokenIds staked by a given account
    /// @param depositor The address of the user
    /// @return The tokenIds of the staked positions
    function stakedValues(address depositor) external view returns (uint256[] memory);

    /// @notice Fetch a staked tokenId by index
    /// @param depositor The address of the user
    /// @param index The index of the staked tokenId
    /// @return The tokenId of the staked position
    function stakedByIndex(address depositor, uint256 index) external view returns (uint256);

    /// @notice Check whether a position is staked in the gauge by a certain user
    /// @param depositor The address of the user
    /// @param tokenId The tokenId of the position
    /// @return Whether the position is staked in the gauge
    function stakedContains(address depositor, uint256 tokenId) external view returns (bool);

    /// @notice The amount of positions staked in the gauge by a certain user
    /// @param depositor The address of the user
    /// @return The amount of positions staked in the gauge
    function stakedLength(address depositor) external view returns (uint256);
}

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

import {IVotingEscrow} from "contracts/core/interfaces/IVotingEscrow.sol";
import {IFactoryRegistry} from "contracts/core/interfaces/IFactoryRegistry.sol";

interface IVoter {
    function ve() external view returns (IVotingEscrow);

    /// @notice Address of Minter.sol
    function minter() external view returns (address);

    function governor() external view returns (address);

    function vote(uint256 _tokenId, address[] calldata _poolVote, uint256[] calldata _weights) external;

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

    function gaugeToFees(address _gauge) external view returns (address);

    function gaugeToBribes(address _gauge) external view returns (address);

    function createGauge(address _poolFactory, address _pool) external returns (address);

    function distribute(address gauge) external;

    function factoryRegistry() external view returns (IFactoryRegistry);

    /// @dev Utility to distribute to gauges of pools in array.
    /// @param _gauges Array of gauges to distribute to.
    function distribute(address[] memory _gauges) external;

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

    function killGauge(address _gauge) external;

    function emergencyCouncil() external view returns (address);

    /// @notice Claim emissions from gauges.
    /// @param _gauges Array of gauges to collect emissions from.
    function claimRewards(address[] memory _gauges) external;

    /// @notice Claim fees for a given NFT.
    /// @dev Utility to help batch fee claims.
    /// @param _fees    Array of FeesVotingReward contracts to collect from.
    /// @param _tokens  Array of tokens that are used as fees.
    /// @param _tokenId Id of veNFT that you wish to claim fees for.
    function claimFees(address[] memory _fees, address[][] memory _tokens, uint256 _tokenId) external;
}

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

/// @title Minimal CLPool interface
/// @notice Used to support the integration with the core implementation
/// @dev For full context, please review the Uniswap implementation under GPL license.
interface ICLPool {
    function token0() external view returns (address);

    function token1() external view returns (address);

    function tickSpacing() external view returns (int24);

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

    /// @notice acts as a virtual reserve that holds information on how many rewards are yet to be distributed
    function rewardReserve() external view returns (uint256);

    /// @notice last time the rewardReserve and rewardRate were updated
    function lastUpdated() external view returns (uint32);

    /// @notice tracks total rewards distributed when no staked liquidity in active tick for epoch ending at periodFinish
    /// @notice this amount is rolled over on the next call to notifyRewardAmount
    /// @dev rollover will always be smaller than the rewards distributed that epoch
    function rollover() external view returns (uint256);

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

    /// @notice Returns data about reward growth within a tick range.
    /// RewardGrowthGlobalX128 can be supplied as a parameter for claimable reward calculations.
    /// @dev Used in gauge reward/earned calculations
    /// @param tickLower The lower tick of the range
    /// @param tickUpper The upper tick of the range
    /// @param _rewardGrowthGlobalX128 a calculated rewardGrowthGlobalX128 or 0 (in case of 0 it means we use the rewardGrowthGlobalX128 from state)
    /// @return rewardGrowthInsideX128 The reward growth in the range
    function getRewardGrowthInside(int24 tickLower, int24 tickUpper, uint256 _rewardGrowthGlobalX128)
        external
        view
        returns (uint256 rewardGrowthInsideX128);

    /// @notice Initialize gauge and nft manager
    /// @dev Callable only once, by the gauge factory
    /// @param _gauge The gauge corresponding to this pool
    /// @param _nft The position manager used for position management
    function setGaugeAndPositionManager(address _gauge, address _nft) external;

    /// @notice Convert existing liquidity into staked liquidity
    /// @notice Only callable by the gauge associated with this pool
    /// @param stakedLiquidityDelta The amount by which to increase or decrease the staked liquidity
    /// @param tickLower The lower tick of the position for which to stake liquidity
    /// @param tickUpper The upper tick of the position for which to stake liquidity
    function stake(int128 stakedLiquidityDelta, int24 tickLower, int24 tickUpper) external;

    /// @notice Updates rewardGrowthGlobalX128 every time when any tick is crossed,
    /// or when any position is staked/unstaked from the gauge
    function updateRewardsGrowthGlobal() external;

    /// @notice Syncs rewards with gauge
    /// @param rewardRate the rate rewards being distributed during the epoch
    /// @param rewardReserve the available rewards to be distributed during the epoch
    /// @param periodFinish the end of the current period of rewards, updated once per epoch
    function syncReward(uint256 rewardRate, uint256 rewardReserve, uint256 periodFinish) external;

    /// @notice Collect the gauge fee accrued to the pool
    /// @return amount0 The gauge fee collected in token0
    /// @return amount1 The gauge fee collected in token1
    function collectFees() external returns (uint128 amount0, uint128 amount1);
}

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

import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";

/// @title Minimal NonfungiblePositionManager interface
/// @notice Used to support the integration with the core implementation
/// @dev For full context, please review the Uniswap implementation under GPL license.
interface INonfungiblePositionManager is IERC721 {
    function positions(uint256 tokenId)
        external
        view
        returns (
            uint96 nonce,
            address operator,
            address token0,
            address token1,
            int24 tickSpacing,
            int24 tickLower,
            int24 tickUpper,
            uint128 liquidity,
            uint256 feeGrowthInside0LastX128,
            uint256 feeGrowthInside1LastX128,
            uint128 tokensOwed0,
            uint128 tokensOwed1
        );

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

    function collect(CollectParams calldata params) external payable returns (uint256 amount0, uint256 amount1);
}

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

pragma solidity ^0.7.0;

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

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

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

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

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

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

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

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

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

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

            return true;
        } else {
            return false;
        }
    }

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

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

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

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

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

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

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

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

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

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

        return result;
    }
}

// SPDX-License-Identifier: MIT
pragma solidity >=0.4.0 <0.8.0;

/// @title Contains 512-bit math functions
/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision
/// @dev Handles "phantom overflow" i.e., allows multiplication and division where an intermediate value overflows 256 bits
library FullMath {
    /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
    /// @param a The multiplicand
    /// @param b The multiplier
    /// @param denominator The divisor
    /// @return result The 256-bit result
    /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv
    function mulDiv(uint256 a, uint256 b, uint256 denominator) internal pure returns (uint256 result) {
        // 512-bit multiply [prod1 prod0] = a * b
        // Compute the product mod 2**256 and mod 2**256 - 1
        // then use the Chinese Remainder Theorem to reconstruct
        // the 512 bit result. The result is stored in two 256
        // variables such that product = prod1 * 2**256 + prod0
        uint256 prod0; // Least significant 256 bits of the product
        uint256 prod1; // Most significant 256 bits of the product
        assembly {
            let mm := mulmod(a, b, not(0))
            prod0 := mul(a, b)
            prod1 := sub(sub(mm, prod0), lt(mm, prod0))
        }

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

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

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

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

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

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

        // Invert denominator mod 2**256
        // Now that denominator is an odd number, it has an inverse
        // modulo 2**256 such that denominator * inv = 1 mod 2**256.
        // Compute the inverse by starting with a seed that is correct
        // correct for four bits. That is, denominator * inv = 1 mod 2**4
        uint256 inv = (3 * denominator) ^ 2;
        // Now use Newton-Raphson iteration to improve the precision.
        // Thanks to Hensel's lifting lemma, this also works in modular
        // arithmetic, doubling the correct bits in each step.
        inv *= 2 - denominator * inv; // inverse mod 2**8
        inv *= 2 - denominator * inv; // inverse mod 2**16
        inv *= 2 - denominator * inv; // inverse mod 2**32
        inv *= 2 - denominator * inv; // inverse mod 2**64
        inv *= 2 - denominator * inv; // inverse mod 2**128
        inv *= 2 - denominator * inv; // inverse mod 2**256

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

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

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

library VelodromeTimeLibrary {
    uint256 internal constant WEEK = 7 days;

    /// @dev Returns start of epoch based on current timestamp
    function epochStart(uint256 timestamp) internal pure returns (uint256) {
        return timestamp - (timestamp % WEEK);
    }

    /// @dev Returns start of next epoch / end of current epoch
    function epochNext(uint256 timestamp) internal pure returns (uint256) {
        return timestamp - (timestamp % WEEK) + WEEK;
    }

    /// @dev Returns start of voting window
    function epochVoteStart(uint256 timestamp) internal pure returns (uint256) {
        return timestamp - (timestamp % WEEK) + 1 hours;
    }

    /// @dev Returns end of voting window / beginning of unrestricted voting window
    function epochVoteEnd(uint256 timestamp) internal pure returns (uint256) {
        return timestamp - (timestamp % WEEK) + WEEK - 1 hours;
    }
}

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

interface IReward {
    event NotifyReward(address indexed from, address indexed reward, uint256 amount);

    /// @notice Add rewards for stakers to earn
    /// @param token    Address of token to reward
    /// @param amount   Amount of token to transfer to rewards
    function notifyRewardAmount(address token, uint256 amount) external;

    /// @notice Calculate how much in rewards are earned for a specific token and veNFT
    /// @param token Address of token to fetch rewards of
    /// @param tokenId Unique identifier of the veNFT
    /// @return Amount of token earned in rewards
    function earned(address token, uint256 tokenId) external view returns (uint256);

    /// @notice Claim the rewards earned by a veNFT staker
    /// @param tokenId  Unique identifier of the veNFT
    /// @param tokens   Array of tokens to claim rewards of
    function getReward(uint256 tokenId, address[] memory tokens) external;
}

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

interface ILeafMessageBridge {
    event ModuleSet(address indexed _sender, address indexed _module);

    /// @notice Returns the address of the xERC20 token that is bridged by this contract
    function xerc20() external view returns (address);

    /// @notice Returns the address of the module contract that is allowed to send messages x-chain
    function module() external view returns (address);

    /// @notice Returns the address of the voter contract
    /// @dev Used to verify the sender of a message
    function voter() external view returns (address);

    /// @notice Sets the address of the module contract that is allowed to send messages x-chain
    /// @dev Module handles x-chain messages
    /// @param _module The address of the new module contract
    function setModule(address _module) external;

    /// @notice Mints xERC20 tokens to a user
    /// @param _recipient The address of the recipient to mint tokens to
    /// @param _amount The amount of xERC20 tokens to mint
    function mint(address _recipient, uint256 _amount) external;
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        uint256 c = a + b;
        if (c < a) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b > a) return (false, 0);
        return (true, a - b);
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) return (true, 0);
        uint256 c = a * b;
        if (c / a != b) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a / b);
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a % b);
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");
        return c;
    }

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

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        if (a == 0) return 0;
        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");
        return c;
    }

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

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

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        return a - b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryDiv}.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a % b;
    }
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 0;
    }

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

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (bool success, ) = recipient.call{ value: amount }("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

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

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

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

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

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: value }(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

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

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

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

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

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

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

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

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

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

interface IVotingEscrow is IERC721 {
    function team() external returns (address);

    /// @notice Check whether spender is owner or an approved user for a given veNFT
    /// @param _spender .
    /// @param _tokenId .
    function isApprovedOrOwner(address _spender, uint256 _tokenId) external returns (bool);
    /// @notice Deposit `_value` tokens for `msg.sender` and lock for `_lockDuration`
    /// @param _value Amount to deposit
    /// @param _lockDuration Number of seconds to lock tokens for (rounded down to nearest week)
    /// @return TokenId of created veNFT
    function createLock(uint256 _value, uint256 _lockDuration) external returns (uint256);
}

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

interface IFactoryRegistry {
    function approve(address poolFactory, address votingRewardsFactory, address gaugeFactory) external;

    function isPoolFactoryApproved(address poolFactory) external returns (bool);

    function factoriesToPoolFactory(address poolFactory)
        external
        returns (address votingRewardsFactory, address gaugeFactory);
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

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

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

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

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

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

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

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

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

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

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

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

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

// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

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

Settings
{
  "remappings": [
    "@ensdomains/=node_modules/@ensdomains/",
    "@solidity-parser/=node_modules/solhint/node_modules/@solidity-parser/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/",
    "hardhat/=node_modules/hardhat/",
    "@openzeppelin/=lib/openzeppelin-contracts/",
    "@nomad-xyz/=lib/ExcessivelySafeCall/",
    "@uniswap/=lib/solidity-lib/",
    "base64-sol/=lib/base64/",
    "ExcessivelySafeCall/=lib/ExcessivelySafeCall/src/",
    "base64/=lib/base64/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/",
    "solidity-lib/=lib/solidity-lib/contracts/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs"
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "istanbul",
  "viaIR": false,
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_pool","type":"address"},{"internalType":"address","name":"_token0","type":"address"},{"internalType":"address","name":"_token1","type":"address"},{"internalType":"int24","name":"_tickSpacing","type":"int24"},{"internalType":"address","name":"_feesVotingReward","type":"address"},{"internalType":"address","name":"_rewardToken","type":"address"},{"internalType":"address","name":"_voter","type":"address"},{"internalType":"address","name":"_nft","type":"address"},{"internalType":"address","name":"_bridge","type":"address"},{"internalType":"bool","name":"_isPool","type":"bool"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"claimed0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"claimed1","type":"uint256"}],"name":"ClaimFees","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ClaimRewards","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"uint128","name":"liquidityToStake","type":"uint128"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"NotifyReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"uint128","name":"liquidityToStake","type":"uint128"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"bridge","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"earned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fees0","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fees1","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feesVotingReward","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isPool","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"lastUpdateTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"left","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nft","outputs":[{"internalType":"contract INonfungiblePositionManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"notifyRewardAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"notifyRewardWithoutClaim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"periodFinish","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pool","outputs":[{"internalType":"contract ICLPool","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rewardGrowthInside","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rewardRateByEpoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"depositor","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"stakedByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"depositor","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"stakedContains","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"depositor","type":"address"}],"name":"stakedLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"depositor","type":"address"}],"name":"stakedValues","outputs":[{"internalType":"uint256[]","name":"staked","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tickSpacing","outputs":[{"internalType":"int24","name":"","type":"int24"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token0","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token1","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"voter","outputs":[{"internalType":"contract IVoter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

0x6101c06040523480156200001257600080fd5b50604051620036e8380380620036e88339810160408190526200003591620000c1565b60016000556001600160601b031960609a8b1b811660c052988a1b89166101405296891b881661016052600295860b90950b60e81b6101805292871b86166101005290861b851661012052851b841660a052841b831660805290921b1660e052151560f81b6101a0526200019c565b80516001600160a01b0381168114620000bc57600080fd5b919050565b6000806000806000806000806000806101408b8d031215620000e1578586fd5b620000ec8b620000a4565b9950620000fc60208c01620000a4565b98506200010c60408c01620000a4565b975060608b01518060020b811462000122578687fd5b96506200013260808c01620000a4565b95506200014260a08c01620000a4565b94506200015260c08c01620000a4565b93506200016260e08c01620000a4565b9250620001736101008c01620000a4565b91506101208b0151801515811462000189578182fd5b809150509295989b9194979a5092959850565b60805160601c60a05160601c60c05160601c60e05160601c6101005160601c6101205160601c6101405160601c6101605160601c6101805160e81c6101a05160f81c6133e062000308600039806116be52806118bb525080610f845280611545525080610f4d528061156952806119d15250806103ed5280610f1152806119b052508061171e52806117885280611c6f5280611ebe5250806104115280611a0f5280611a4b5280611ade5280611b1a5250806109d352806115e052806116e252508061046852806107d752806111d3528061128052806118e85280611bed5280611c995280611d5a5280611df65280611fb5528061205752806120ec5280612197528061225152806123c152806124ed52806125a5525080610b135280610dae52806113c55250806105175280610691528061071f52806108a55280610b375280610ce45280610e595280611000528061109e528061113e528061144e52806122fb52506133e06000f3fe608060405234801561001057600080fd5b50600436106101e55760003560e01c80637b0a47ee1161010f578063d0c93a7c116100a2578063e78cea9211610071578063e78cea92146103c0578063ebe2b12b146103c8578063f301af42146103d0578063f7c618c1146103e3576101e5565b8063d0c93a7c14610388578063d21220a71461039d578063dcdc18dc146103a5578063e2e1c6db146103b8576101e5565b8063ae775c32116100de578063ae775c321461032f578063b6b55f2514610342578063c00007b014610355578063c69deec514610368576101e5565b80637b0a47ee146102f957806393f1c4421461030157806394af5b6314610309578063ac789c081461031c576101e5565b8063384639371161018757806347ccca021161015657806347ccca02146102b65780634b937763146102be5780634bcddb1f146102de5780634c02a21c146102f1576101e5565b806338463937146102755780633c6b16ab146102885780633e491d471461029b57806346c96aac146102ae576101e5565b806316e64048116101c357806316e640481461023057806316f0115b146102455780631c4b774b1461024d5780632e1a7d4d14610262576101e5565b80630dfe1681146101ea5780630fe2f71114610208578063150b7a0214610210575b600080fd5b6101f26103eb565b6040516101ff9190613081565b60405180910390f35b6101f261040f565b61022361021e366004612dd0565b610433565b6040516101ff9190613121565b610238610443565b6040516101ff91906132a6565b6101f2610466565b61026061025b366004612f2b565b61048a565b005b610260610270366004612f2b565b6105d6565b610238610283366004612e94565b610953565b610260610296366004612f2b565b61097e565b6102386102a9366004612e94565b610aca565b6101f2610b11565b6101f2610b35565b6102d16102cc366004612d98565b610b59565b6040516101ff91906130d2565b6102386102ec366004612f2b565b610c17565b610238610c29565b610238610c2f565b610238610c35565b610238610317366004612f2b565b610c3b565b61023861032a366004612f2b565b610c4d565b61023861033d366004612d98565b610c5f565b610260610350366004612f2b565b610c88565b610260610363366004612d98565b61136f565b61037b610376366004612e94565b611521565b6040516101ff9190613116565b610390611543565b6040516101ff9190613155565b6101f2611567565b6102606103b3366004612f2b565b61158b565b61037b6116bc565b6101f26116e0565b610238611704565b6102386103de366004612f2b565b61170a565b6101f261171c565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b630a85bd0160e11b949350505050565b6000600154421061045657506000610463565b5060015460025442909103025b90565b7f000000000000000000000000000000000000000000000000000000000000000081565b600260005414156104d0576040805162461bcd60e51b815260206004820152601f60248201526000805160206132ec833981519152604482015290519081900360640190fd5b600260009081553381526004602052604090206104ed9082611740565b6105125760405162461bcd60e51b815260040161050990613247565b60405180910390fd5b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166399fbab88846040518263ffffffff1660e01b815260040161056191906132a6565b6101806040518083038186803b15801561057a57600080fd5b505afa15801561058e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105b29190612fa2565b50505050509650965050505050506105cc8282853361174c565b5050600160005550565b6002600054141561061c576040805162461bcd60e51b815260206004820152601f60248201526000805160206132ec833981519152604482015290519081900360640190fd5b600260009081553381526004602052604090206106399082611740565b6106555760405162461bcd60e51b815260040161050990613247565b604080516080810182528281523360208201526001600160801b038183018190526060820152905163fc6f786560e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163fc6f7865916106c59190600401613263565b6040805180830381600087803b1580156106de57600080fd5b505af11580156106f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107169190612f5b565b505060008060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166399fbab88856040518263ffffffff1660e01b815260040161076991906132a6565b6101806040518083038186803b15801561078257600080fd5b505afa158015610796573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ba9190612fa2565b5050505097509750975050505050506107d58383863361174c565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638f50914d61081e610819846001600160801b03166117f8565b611840565b60000385856040518463ffffffff1660e01b815260040161084193929190613136565b600060405180830381600087803b15801561085b57600080fd5b505af115801561086f573d6000803e3d6000fd5b505033600090815260046020526040902061088d92509050856118a1565b50604051632142170760e11b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906342842e0e906108de90309033908990600401613095565b600060405180830381600087803b1580156108f857600080fd5b505af115801561090c573d6000803e3d6000fd5b50506040516001600160801b038416925086915033907f8903a5b5d08a841e7f68438387f1da20c84dea756379ed37e633ff3854b99b8490600090a4505060016000555050565b6001600160a01b038216600090815260046020526040812061097590836118ad565b90505b92915050565b600260005414156109c4576040805162461bcd60e51b815260206004820152601f60248201526000805160206132ec833981519152604482015290519081900360640190fd5b600260008190555060003390507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b86d52986040518163ffffffff1660e01b815260040160206040518083038186803b158015610a2a57600080fd5b505afa158015610a3e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a629190612db4565b6001600160a01b0316816001600160a01b031614610a925760405162461bcd60e51b81526004016105099061319d565b81610aaf5760405162461bcd60e51b815260040161050990613181565b610ab76118b9565b610ac18183611bdb565b50506001600055565b6001600160a01b0382166000908152600460205260408120610aec9083611740565b610b085760405162461bcd60e51b815260040161050990613247565b61097582611fb0565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b6001600160a01b038116600090815260046020526040812060609190610b7e9061248d565b90508067ffffffffffffffff81118015610b9757600080fd5b50604051908082528060200260200182016040528015610bc1578160200160208202803683370190505b50915060005b81811015610c10576001600160a01b0384166000908152600460205260409020610bf190826118ad565b838281518110610bfd57fe5b6020908102919091010152600101610bc7565b5050919050565b60076020526000908152604090205481565b60095481565b60025481565b60085481565b60036020526000908152604090205481565b60056020526000908152604090205481565b6001600160a01b0381166000908152600460205260408120610c809061248d565b90505b919050565b60026000541415610cce576040805162461bcd60e51b815260206004820152601f60248201526000805160206132ec833981519152604482015290519081900360640190fd5b60026000556040516331a9108f60e11b815233907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90610d219085906004016132a6565b60206040518083038186803b158015610d3957600080fd5b505afa158015610d4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d719190612db4565b6001600160a01b031614610d975760405162461bcd60e51b815260040161050990613247565b604051631703e5f960e01b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631703e5f990610de3903090600401613081565b60206040518083038186803b158015610dfb57600080fd5b505afa158015610e0f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e339190612ebf565b610e4f5760405162461bcd60e51b81526004016105099061322b565b60008060008060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166399fbab88876040518263ffffffff1660e01b8152600401610ea391906132a6565b6101806040518083038186803b158015610ebc57600080fd5b505afa158015610ed0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef49190612fa2565b5050505050965096509650965096505050846001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316148015610f775750836001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316145b8015610fa857508260020b7f000000000000000000000000000000000000000000000000000000000000000060020b145b610fc45760405162461bcd60e51b81526004016105099061320f565b604080516080810182528781523360208201526001600160801b038183018190526060820152905163fc6f786560e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163fc6f7865916110349190600401613263565b6040805180830381600087803b15801561104d57600080fd5b505af1158015611061573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110859190612f5b565b5050604051632142170760e11b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906342842e0e906110d790339030908b90600401613095565b600060405180830381600087803b1580156110f157600080fd5b505af1158015611105573d6000803e3d6000fd5b50503360009081526004602052604090206111239250905087612498565b5060405163133f757160e31b81526000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906399fbab8890611173908a906004016132a6565b6101806040518083038186803b15801561118c57600080fd5b505afa1580156111a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111c49190612fa2565b505050509750505050505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638f50914d611215610819846001600160801b03166117f8565b85856040518463ffffffff1660e01b815260040161123593929190613136565b600060405180830381600087803b15801561124f57600080fd5b505af1158015611263573d6000803e3d6000fd5b505060405163a16368c960e01b8152600092506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016915063a16368c9906112ba90879087908690600401613163565b60206040518083038186803b1580156112d257600080fd5b505afa1580156112e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061130a9190612f43565b60008981526005602090815260408083208490556007909152808220429055519192506001600160801b038416918a9133917f1c8ab8c7f45390d58f58f1d655213a82cca5d12179761a87c16f098813b8f2119190a450506001600055505050505050565b600260005414156113b5576040805162461bcd60e51b815260206004820152601f60248201526000805160206132ec833981519152604482015290519081900360640190fd5b6002600055336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146114025760405162461bcd60e51b8152600401610509906131b9565b6001600160a01b0381166000908152600460205260408120611423906124a4565b805190915060008080805b848110156115135785818151811061144257fe5b602002602001015193507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166399fbab88856040518263ffffffff1660e01b815260040161149891906132a6565b6101806040518083038186803b1580156114b157600080fd5b505afa1580156114c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114e99190612fa2565b50949c50929a5061150b98508b97508a96508c95508f945061174c9350505050565b60010161142e565b505060016000555050505050565b6001600160a01b03821660009081526004602052604081206109759083611740565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b600260005414156115d1576040805162461bcd60e51b815260206004820152601f60248201526000805160206132ec833981519152604482015290519081900360640190fd5b600260008190555060003390507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b86d52986040518163ffffffff1660e01b815260040160206040518083038186803b15801561163757600080fd5b505afa15801561164b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061166f9190612db4565b6001600160a01b0316816001600160a01b03161461169f5760405162461bcd60e51b81526004016105099061319d565b81610ab75760405162461bcd60e51b815260040161050990613181565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b60015481565b60066020526000908152604090205481565b7f000000000000000000000000000000000000000000000000000000000000000081565b600061097583836124b8565b6117578285856124d0565b60008281526006602052604090205480156117f1576000838152600660205260408120556117af6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168383612642565b816001600160a01b03167f1f89f96333d3133000ee447473151fa9606543368f02271c9d95ae14f13bcc67826040516117e891906132a6565b60405180910390a25b5050505050565b6000600160ff1b821061183c5760405162461bcd60e51b81526004018080602001828103825260288152602001806133596028913960400191505060405180910390fd5b5090565b60006f7fffffffffffffffffffffffffffffff19821215801561186657506001607f1b82125b61183c5760405162461bcd60e51b815260040180806020018281038252602781526020018061330c6027913960400191505060405180910390fd5b60006109758383612694565b6000610975838361275c565b7f00000000000000000000000000000000000000000000000000000000000000006118e357611bd9565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c87965726040518163ffffffff1660e01b81526004016040805180830381600087803b15801561194057600080fd5b505af1158015611954573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119789190612ef9565b6001600160801b031691506001600160801b03169150600082118061199d5750600081115b15611bd6576008546009549083019082017f00000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000062093a80841115611ab9576000600855611a346001600160a01b0383167f000000000000000000000000000000000000000000000000000000000000000086612780565b60405163b66503cf60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063b66503cf90611a8290859088906004016130b9565b600060405180830381600087803b158015611a9c57600080fd5b505af1158015611ab0573d6000803e3d6000fd5b50505050611abf565b60088490555b62093a80831115611b88576000600955611b036001600160a01b0382167f000000000000000000000000000000000000000000000000000000000000000085612780565b60405163b66503cf60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063b66503cf90611b5190849087906004016130b9565b600060405180830381600087803b158015611b6b57600080fd5b505af1158015611b7f573d6000803e3d6000fd5b50505050611b8e565b60098390555b336001600160a01b03167fbc567d6cbad26368064baa0ab5a757be46aae4d70f707f9203d9d9b6c8ccbfa38787604051611bc99291906132af565b60405180910390a2505050505b50505b565b42600081611be881612871565b0390507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316631b4109606040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611c4657600080fd5b505af1158015611c5a573d6000803e3d6000fd5b5050508282019050611c976001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001686308761287f565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b056b49a6040518163ffffffff1660e01b815260040160206040518083038186803b158015611cf057600080fd5b505afa158015611d04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d289190612f43565b6001549401938310611dc957818481611d3d57fe5b0460028190556040516360a73f9b60e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916360a73f9b91611d929190889086906004016132bd565b600060405180830381600087803b158015611dac57600080fd5b505af1158015611dc0573d6000803e3d6000fd5b50505050611e64565b60025482028285820181611dd957fe5b0460028190556040516360a73f9b60e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916360a73f9b91611e3091908986019087906004016132bd565b600060405180830381600087803b158015611e4a57600080fd5b505af1158015611e5e573d6000803e3d6000fd5b50505050505b60025460036000611e74866128d9565b8152602081019190915260400160002055600254611ea45760405162461bcd60e51b8152600401610509906131d5565b6040516370a0823160e01b81526000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190611ef3903090600401613081565b60206040518083038186803b158015611f0b57600080fd5b505afa158015611f1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f439190612f43565b9050828181611f4e57fe5b046002541115611f705760405162461bcd60e51b8152600401610509906131f2565b81600181905550856001600160a01b03167f095667752957714306e1a6ad83495404412df6fdb932fca6dc849a7ee910d4c186604051611bc991906132a6565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0b06f5d6040518163ffffffff1660e01b815260040160206040518083038186803b15801561200c57600080fd5b505afa158015612020573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120449190612f7e565b63ffffffff1690506000814203905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166357806ada6040518163ffffffff1660e01b815260040160206040518083038186803b1580156120ae57600080fd5b505afa1580156120c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120e69190612f43565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663cab64bcd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561214357600080fd5b505afa158015612157573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061217b9190612f43565b9050821580159061218c5750600081115b8015612231575060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633ab04b206040518163ffffffff1660e01b815260040160206040518083038186803b1580156121ee57600080fd5b505afa158015612202573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122269190612edf565b6001600160801b0316115b156122f4576002548302818111156122465750805b6122ee81600160801b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633ab04b206040518163ffffffff1660e01b815260040160206040518083038186803b1580156122a857600080fd5b505afa1580156122bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122e09190612edf565b6001600160801b03166128e4565b83019250505b60008060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166399fbab888a6040518263ffffffff1660e01b815260040161234591906132a6565b6101806040518083038186803b15801561235e57600080fd5b505afa158015612372573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123969190612fa2565b5050505097509750975050505050506000600560008b815260200190815260200160002054905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663a16368c986868a6040518463ffffffff1660e01b815260040161240f93929190613163565b60206040518083038186803b15801561242757600080fd5b505afa15801561243b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061245f9190612f43565b9050600061247d838303856001600160801b0316600160801b6128e4565b9c9b505050505050505050505050565b6000610c8082612993565b60006109758383612997565b606060006124b1836129e1565b9392505050565b60009081526001919091016020526040902054151590565b6000838152600760205260409020544214156124eb5761263d565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316631b4109606040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561254657600080fd5b505af115801561255a573d6000803e3d6000fd5b50505060008481526007602052604090204290555061257883611fb0565b6000848152600660205260408082208054909301909255905163a16368c960e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163a16368c9916125dd918691869190600401613163565b60206040518083038186803b1580156125f557600080fd5b505afa158015612609573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061262d9190612f43565b6000848152600560205260409020555b505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261263d908490612a3d565b60008181526001830160205260408120548015612752578354600019808301910180821461270c5760008660000182815481106126cd57fe5b90600052602060002001549050808760000184815481106126ea57fe5b6000918252602080832090910192909255918252600188019052604090208390555b855486908061271757fe5b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610978565b6000915050610978565b600082600001828154811061276d57fe5b9060005260206000200154905092915050565b600061281682856001600160a01b031663dd62ed3e30876040518363ffffffff1660e01b815260040180836001600160a01b03168152602001826001600160a01b031681526020019250505060206040518083038186803b1580156127e457600080fd5b505afa1580156127f8573d6000803e3d6000fd5b505050506040513d602081101561280e57600080fd5b505190612aee565b604080516001600160a01b038616602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b17905290915061286b908590612a3d565b50505050565b62093a808082069091030190565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261286b908590612a3d565b62093a808106900390565b600080806000198587098686029250828110908390030390508061291a576000841161290f57600080fd5b5082900490506124b1565b80841161292657600080fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b5490565b60006129a383836124b8565b6129d957508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610978565b506000610978565b606081600001805480602002602001604051908101604052809291908181526020018280548015612a3157602002820191906000526020600020905b815481526020019060010190808311612a1d575b50505050509050919050565b6000612a92826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612b489092919063ffffffff16565b80519091501561263d57808060200190516020811015612ab157600080fd5b505161263d5760405162461bcd60e51b815260040180806020018281038252602a815260200180613381602a913960400191505060405180910390fd5b600082820183811015610975576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6060612b578484600085612b5f565b949350505050565b606082471015612ba05760405162461bcd60e51b81526004018080602001828103825260268152602001806133336026913960400191505060405180910390fd5b612ba985612cba565b612bfa576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b60208310612c385780518252601f199092019160209182019101612c19565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612c9a576040519150601f19603f3d011682016040523d82523d6000602084013e612c9f565b606091505b5091509150612caf828286612cc0565b979650505050505050565b3b151590565b60608315612ccf5750816124b1565b825115612cdf5782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612d29578181015183820152602001612d11565b50505050905090810190601f168015612d565780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b8051610c83816132d3565b8051600281900b8114610c8357600080fd5b80516001600160801b0381168114610c8357600080fd5b600060208284031215612da9578081fd5b8135610975816132d3565b600060208284031215612dc5578081fd5b8151610975816132d3565b60008060008060808587031215612de5578283fd5b8435612df0816132d3565b9350602085810135612e01816132d3565b935060408601359250606086013567ffffffffffffffff80821115612e24578384fd5b818801915088601f830112612e37578384fd5b813581811115612e4357fe5b604051601f8201601f1916810185018381118282101715612e6057fe5b60405281815283820185018b1015612e76578586fd5b81858501868301379081019093019390935250939692955090935050565b60008060408385031215612ea6578182fd5b8235612eb1816132d3565b946020939093013593505050565b600060208284031215612ed0578081fd5b81518015158114610975578182fd5b600060208284031215612ef0578081fd5b61097582612d81565b60008060408385031215612f0b578182fd5b612f1483612d81565b9150612f2260208401612d81565b90509250929050565b600060208284031215612f3c578081fd5b5035919050565b600060208284031215612f54578081fd5b5051919050565b60008060408385031215612f6d578182fd5b505080516020909101519092909150565b600060208284031215612f8f578081fd5b815163ffffffff81168114610975578182fd5b6000806000806000806000806000806000806101808d8f031215612fc4578788fd5b8c516bffffffffffffffffffffffff81168114612fdf578889fd5b9b50612fed60208e01612d64565b9a50612ffb60408e01612d64565b995061300960608e01612d64565b985061301760808e01612d6f565b975061302560a08e01612d6f565b965061303360c08e01612d6f565b955061304160e08e01612d81565b94506101008d015193506101208d015192506130606101408e01612d81565b915061306f6101608e01612d81565b90509295989b509295989b509295989b565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b8181101561310a578351835292840192918401916001016130ee565b50909695505050505050565b901515815260200190565b6001600160e01b031991909116815260200190565b600f9390930b8352600291820b6020840152900b604082015260600190565b60029190910b815260200190565b600293840b81529190920b6020820152604081019190915260600190565b6020808252600290820152612d2960f11b604082015260600190565b6020808252600290820152614e4d60f01b604082015260600190565b602080825260029082015261272b60f11b604082015260600190565b6020808252600390820152622d292960e91b604082015260600190565b6020808252600390820152620a4a4960eb1b604082015260600190565b602080825260029082015261504d60f01b604082015260600190565b602080825260029082015261474b60f01b604082015260600190565b6020808252600290820152614e4160f01b604082015260600190565b815181526020808301516001600160a01b0316908201526040808301516001600160801b0390811691830191909152606092830151169181019190915260800190565b90815260200190565b918252602082015260400190565b9283526020830191909152604082015260600190565b6001600160a01b03811681146132e857600080fd5b5056fe5265656e7472616e637947756172643a207265656e7472616e742063616c6c0053616665436173743a2076616c756520646f65736e27742066697420696e203132382062697473416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c53616665436173743a2076616c756520646f65736e27742066697420696e20616e20696e743235365361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220ae0a74b284d73ae1b98b50f379f35cf8b48e131521c85938d48de75685598eef64736f6c6343000706003300000000000000000000000002e7480ffb8fe71d0cbe696e1aa10459affed420000000000000000000000000c38173d34afaea88bc482813b3cd267bc8a1ea83000000000000000000000000fc00000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000003200000000000000000000000062af7d48462ff97cb69a09100590731eb3280daa0000000000000000000000007f9adfbd38b669f03d1d11000bc76b9aaea28a8100000000000000000000000097cdbce21b6fd0585d29e539b1b99dad328a1123000000000000000000000000991d5546c4b442b4c5fdc4c8b8b8d131deb24702000000000000000000000000f278761576f45472bdd721eaca19317ce159c0110000000000000000000000000000000000000000000000000000000000000001

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101e55760003560e01c80637b0a47ee1161010f578063d0c93a7c116100a2578063e78cea9211610071578063e78cea92146103c0578063ebe2b12b146103c8578063f301af42146103d0578063f7c618c1146103e3576101e5565b8063d0c93a7c14610388578063d21220a71461039d578063dcdc18dc146103a5578063e2e1c6db146103b8576101e5565b8063ae775c32116100de578063ae775c321461032f578063b6b55f2514610342578063c00007b014610355578063c69deec514610368576101e5565b80637b0a47ee146102f957806393f1c4421461030157806394af5b6314610309578063ac789c081461031c576101e5565b8063384639371161018757806347ccca021161015657806347ccca02146102b65780634b937763146102be5780634bcddb1f146102de5780634c02a21c146102f1576101e5565b806338463937146102755780633c6b16ab146102885780633e491d471461029b57806346c96aac146102ae576101e5565b806316e64048116101c357806316e640481461023057806316f0115b146102455780631c4b774b1461024d5780632e1a7d4d14610262576101e5565b80630dfe1681146101ea5780630fe2f71114610208578063150b7a0214610210575b600080fd5b6101f26103eb565b6040516101ff9190613081565b60405180910390f35b6101f261040f565b61022361021e366004612dd0565b610433565b6040516101ff9190613121565b610238610443565b6040516101ff91906132a6565b6101f2610466565b61026061025b366004612f2b565b61048a565b005b610260610270366004612f2b565b6105d6565b610238610283366004612e94565b610953565b610260610296366004612f2b565b61097e565b6102386102a9366004612e94565b610aca565b6101f2610b11565b6101f2610b35565b6102d16102cc366004612d98565b610b59565b6040516101ff91906130d2565b6102386102ec366004612f2b565b610c17565b610238610c29565b610238610c2f565b610238610c35565b610238610317366004612f2b565b610c3b565b61023861032a366004612f2b565b610c4d565b61023861033d366004612d98565b610c5f565b610260610350366004612f2b565b610c88565b610260610363366004612d98565b61136f565b61037b610376366004612e94565b611521565b6040516101ff9190613116565b610390611543565b6040516101ff9190613155565b6101f2611567565b6102606103b3366004612f2b565b61158b565b61037b6116bc565b6101f26116e0565b610238611704565b6102386103de366004612f2b565b61170a565b6101f261171c565b7f000000000000000000000000c38173d34afaea88bc482813b3cd267bc8a1ea8381565b7f00000000000000000000000062af7d48462ff97cb69a09100590731eb3280daa81565b630a85bd0160e11b949350505050565b6000600154421061045657506000610463565b5060015460025442909103025b90565b7f00000000000000000000000002e7480ffb8fe71d0cbe696e1aa10459affed42081565b600260005414156104d0576040805162461bcd60e51b815260206004820152601f60248201526000805160206132ec833981519152604482015290519081900360640190fd5b600260009081553381526004602052604090206104ed9082611740565b6105125760405162461bcd60e51b815260040161050990613247565b60405180910390fd5b6000807f000000000000000000000000991d5546c4b442b4c5fdc4c8b8b8d131deb247026001600160a01b03166399fbab88846040518263ffffffff1660e01b815260040161056191906132a6565b6101806040518083038186803b15801561057a57600080fd5b505afa15801561058e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105b29190612fa2565b50505050509650965050505050506105cc8282853361174c565b5050600160005550565b6002600054141561061c576040805162461bcd60e51b815260206004820152601f60248201526000805160206132ec833981519152604482015290519081900360640190fd5b600260009081553381526004602052604090206106399082611740565b6106555760405162461bcd60e51b815260040161050990613247565b604080516080810182528281523360208201526001600160801b038183018190526060820152905163fc6f786560e01b81526001600160a01b037f000000000000000000000000991d5546c4b442b4c5fdc4c8b8b8d131deb24702169163fc6f7865916106c59190600401613263565b6040805180830381600087803b1580156106de57600080fd5b505af11580156106f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107169190612f5b565b505060008060007f000000000000000000000000991d5546c4b442b4c5fdc4c8b8b8d131deb247026001600160a01b03166399fbab88856040518263ffffffff1660e01b815260040161076991906132a6565b6101806040518083038186803b15801561078257600080fd5b505afa158015610796573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ba9190612fa2565b5050505097509750975050505050506107d58383863361174c565b7f00000000000000000000000002e7480ffb8fe71d0cbe696e1aa10459affed4206001600160a01b0316638f50914d61081e610819846001600160801b03166117f8565b611840565b60000385856040518463ffffffff1660e01b815260040161084193929190613136565b600060405180830381600087803b15801561085b57600080fd5b505af115801561086f573d6000803e3d6000fd5b505033600090815260046020526040902061088d92509050856118a1565b50604051632142170760e11b81526001600160a01b037f000000000000000000000000991d5546c4b442b4c5fdc4c8b8b8d131deb2470216906342842e0e906108de90309033908990600401613095565b600060405180830381600087803b1580156108f857600080fd5b505af115801561090c573d6000803e3d6000fd5b50506040516001600160801b038416925086915033907f8903a5b5d08a841e7f68438387f1da20c84dea756379ed37e633ff3854b99b8490600090a4505060016000555050565b6001600160a01b038216600090815260046020526040812061097590836118ad565b90505b92915050565b600260005414156109c4576040805162461bcd60e51b815260206004820152601f60248201526000805160206132ec833981519152604482015290519081900360640190fd5b600260008190555060003390507f000000000000000000000000f278761576f45472bdd721eaca19317ce159c0116001600160a01b031663b86d52986040518163ffffffff1660e01b815260040160206040518083038186803b158015610a2a57600080fd5b505afa158015610a3e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a629190612db4565b6001600160a01b0316816001600160a01b031614610a925760405162461bcd60e51b81526004016105099061319d565b81610aaf5760405162461bcd60e51b815260040161050990613181565b610ab76118b9565b610ac18183611bdb565b50506001600055565b6001600160a01b0382166000908152600460205260408120610aec9083611740565b610b085760405162461bcd60e51b815260040161050990613247565b61097582611fb0565b7f00000000000000000000000097cdbce21b6fd0585d29e539b1b99dad328a112381565b7f000000000000000000000000991d5546c4b442b4c5fdc4c8b8b8d131deb2470281565b6001600160a01b038116600090815260046020526040812060609190610b7e9061248d565b90508067ffffffffffffffff81118015610b9757600080fd5b50604051908082528060200260200182016040528015610bc1578160200160208202803683370190505b50915060005b81811015610c10576001600160a01b0384166000908152600460205260409020610bf190826118ad565b838281518110610bfd57fe5b6020908102919091010152600101610bc7565b5050919050565b60076020526000908152604090205481565b60095481565b60025481565b60085481565b60036020526000908152604090205481565b60056020526000908152604090205481565b6001600160a01b0381166000908152600460205260408120610c809061248d565b90505b919050565b60026000541415610cce576040805162461bcd60e51b815260206004820152601f60248201526000805160206132ec833981519152604482015290519081900360640190fd5b60026000556040516331a9108f60e11b815233907f000000000000000000000000991d5546c4b442b4c5fdc4c8b8b8d131deb247026001600160a01b031690636352211e90610d219085906004016132a6565b60206040518083038186803b158015610d3957600080fd5b505afa158015610d4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d719190612db4565b6001600160a01b031614610d975760405162461bcd60e51b815260040161050990613247565b604051631703e5f960e01b81526001600160a01b037f00000000000000000000000097cdbce21b6fd0585d29e539b1b99dad328a11231690631703e5f990610de3903090600401613081565b60206040518083038186803b158015610dfb57600080fd5b505afa158015610e0f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e339190612ebf565b610e4f5760405162461bcd60e51b81526004016105099061322b565b60008060008060007f000000000000000000000000991d5546c4b442b4c5fdc4c8b8b8d131deb247026001600160a01b03166399fbab88876040518263ffffffff1660e01b8152600401610ea391906132a6565b6101806040518083038186803b158015610ebc57600080fd5b505afa158015610ed0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef49190612fa2565b5050505050965096509650965096505050846001600160a01b03167f000000000000000000000000c38173d34afaea88bc482813b3cd267bc8a1ea836001600160a01b0316148015610f775750836001600160a01b03167f000000000000000000000000fc000000000000000000000000000000000000016001600160a01b0316145b8015610fa857508260020b7f000000000000000000000000000000000000000000000000000000000000003260020b145b610fc45760405162461bcd60e51b81526004016105099061320f565b604080516080810182528781523360208201526001600160801b038183018190526060820152905163fc6f786560e01b81526001600160a01b037f000000000000000000000000991d5546c4b442b4c5fdc4c8b8b8d131deb24702169163fc6f7865916110349190600401613263565b6040805180830381600087803b15801561104d57600080fd5b505af1158015611061573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110859190612f5b565b5050604051632142170760e11b81526001600160a01b037f000000000000000000000000991d5546c4b442b4c5fdc4c8b8b8d131deb2470216906342842e0e906110d790339030908b90600401613095565b600060405180830381600087803b1580156110f157600080fd5b505af1158015611105573d6000803e3d6000fd5b50503360009081526004602052604090206111239250905087612498565b5060405163133f757160e31b81526000906001600160a01b037f000000000000000000000000991d5546c4b442b4c5fdc4c8b8b8d131deb2470216906399fbab8890611173908a906004016132a6565b6101806040518083038186803b15801561118c57600080fd5b505afa1580156111a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111c49190612fa2565b505050509750505050505050507f00000000000000000000000002e7480ffb8fe71d0cbe696e1aa10459affed4206001600160a01b0316638f50914d611215610819846001600160801b03166117f8565b85856040518463ffffffff1660e01b815260040161123593929190613136565b600060405180830381600087803b15801561124f57600080fd5b505af1158015611263573d6000803e3d6000fd5b505060405163a16368c960e01b8152600092506001600160a01b037f00000000000000000000000002e7480ffb8fe71d0cbe696e1aa10459affed42016915063a16368c9906112ba90879087908690600401613163565b60206040518083038186803b1580156112d257600080fd5b505afa1580156112e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061130a9190612f43565b60008981526005602090815260408083208490556007909152808220429055519192506001600160801b038416918a9133917f1c8ab8c7f45390d58f58f1d655213a82cca5d12179761a87c16f098813b8f2119190a450506001600055505050505050565b600260005414156113b5576040805162461bcd60e51b815260206004820152601f60248201526000805160206132ec833981519152604482015290519081900360640190fd5b6002600055336001600160a01b037f00000000000000000000000097cdbce21b6fd0585d29e539b1b99dad328a112316146114025760405162461bcd60e51b8152600401610509906131b9565b6001600160a01b0381166000908152600460205260408120611423906124a4565b805190915060008080805b848110156115135785818151811061144257fe5b602002602001015193507f000000000000000000000000991d5546c4b442b4c5fdc4c8b8b8d131deb247026001600160a01b03166399fbab88856040518263ffffffff1660e01b815260040161149891906132a6565b6101806040518083038186803b1580156114b157600080fd5b505afa1580156114c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114e99190612fa2565b50949c50929a5061150b98508b97508a96508c95508f945061174c9350505050565b60010161142e565b505060016000555050505050565b6001600160a01b03821660009081526004602052604081206109759083611740565b7f000000000000000000000000000000000000000000000000000000000000003281565b7f000000000000000000000000fc0000000000000000000000000000000000000181565b600260005414156115d1576040805162461bcd60e51b815260206004820152601f60248201526000805160206132ec833981519152604482015290519081900360640190fd5b600260008190555060003390507f000000000000000000000000f278761576f45472bdd721eaca19317ce159c0116001600160a01b031663b86d52986040518163ffffffff1660e01b815260040160206040518083038186803b15801561163757600080fd5b505afa15801561164b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061166f9190612db4565b6001600160a01b0316816001600160a01b03161461169f5760405162461bcd60e51b81526004016105099061319d565b81610ab75760405162461bcd60e51b815260040161050990613181565b7f000000000000000000000000000000000000000000000000000000000000000181565b7f000000000000000000000000f278761576f45472bdd721eaca19317ce159c01181565b60015481565b60066020526000908152604090205481565b7f0000000000000000000000007f9adfbd38b669f03d1d11000bc76b9aaea28a8181565b600061097583836124b8565b6117578285856124d0565b60008281526006602052604090205480156117f1576000838152600660205260408120556117af6001600160a01b037f0000000000000000000000007f9adfbd38b669f03d1d11000bc76b9aaea28a81168383612642565b816001600160a01b03167f1f89f96333d3133000ee447473151fa9606543368f02271c9d95ae14f13bcc67826040516117e891906132a6565b60405180910390a25b5050505050565b6000600160ff1b821061183c5760405162461bcd60e51b81526004018080602001828103825260288152602001806133596028913960400191505060405180910390fd5b5090565b60006f7fffffffffffffffffffffffffffffff19821215801561186657506001607f1b82125b61183c5760405162461bcd60e51b815260040180806020018281038252602781526020018061330c6027913960400191505060405180910390fd5b60006109758383612694565b6000610975838361275c565b7f00000000000000000000000000000000000000000000000000000000000000016118e357611bd9565b6000807f00000000000000000000000002e7480ffb8fe71d0cbe696e1aa10459affed4206001600160a01b031663c87965726040518163ffffffff1660e01b81526004016040805180830381600087803b15801561194057600080fd5b505af1158015611954573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119789190612ef9565b6001600160801b031691506001600160801b03169150600082118061199d5750600081115b15611bd6576008546009549083019082017f000000000000000000000000c38173d34afaea88bc482813b3cd267bc8a1ea837f000000000000000000000000fc0000000000000000000000000000000000000162093a80841115611ab9576000600855611a346001600160a01b0383167f00000000000000000000000062af7d48462ff97cb69a09100590731eb3280daa86612780565b60405163b66503cf60e01b81526001600160a01b037f00000000000000000000000062af7d48462ff97cb69a09100590731eb3280daa169063b66503cf90611a8290859088906004016130b9565b600060405180830381600087803b158015611a9c57600080fd5b505af1158015611ab0573d6000803e3d6000fd5b50505050611abf565b60088490555b62093a80831115611b88576000600955611b036001600160a01b0382167f00000000000000000000000062af7d48462ff97cb69a09100590731eb3280daa85612780565b60405163b66503cf60e01b81526001600160a01b037f00000000000000000000000062af7d48462ff97cb69a09100590731eb3280daa169063b66503cf90611b5190849087906004016130b9565b600060405180830381600087803b158015611b6b57600080fd5b505af1158015611b7f573d6000803e3d6000fd5b50505050611b8e565b60098390555b336001600160a01b03167fbc567d6cbad26368064baa0ab5a757be46aae4d70f707f9203d9d9b6c8ccbfa38787604051611bc99291906132af565b60405180910390a2505050505b50505b565b42600081611be881612871565b0390507f00000000000000000000000002e7480ffb8fe71d0cbe696e1aa10459affed4206001600160a01b0316631b4109606040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611c4657600080fd5b505af1158015611c5a573d6000803e3d6000fd5b5050508282019050611c976001600160a01b037f0000000000000000000000007f9adfbd38b669f03d1d11000bc76b9aaea28a811686308761287f565b7f00000000000000000000000002e7480ffb8fe71d0cbe696e1aa10459affed4206001600160a01b031663b056b49a6040518163ffffffff1660e01b815260040160206040518083038186803b158015611cf057600080fd5b505afa158015611d04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d289190612f43565b6001549401938310611dc957818481611d3d57fe5b0460028190556040516360a73f9b60e01b81526001600160a01b037f00000000000000000000000002e7480ffb8fe71d0cbe696e1aa10459affed42016916360a73f9b91611d929190889086906004016132bd565b600060405180830381600087803b158015611dac57600080fd5b505af1158015611dc0573d6000803e3d6000fd5b50505050611e64565b60025482028285820181611dd957fe5b0460028190556040516360a73f9b60e01b81526001600160a01b037f00000000000000000000000002e7480ffb8fe71d0cbe696e1aa10459affed42016916360a73f9b91611e3091908986019087906004016132bd565b600060405180830381600087803b158015611e4a57600080fd5b505af1158015611e5e573d6000803e3d6000fd5b50505050505b60025460036000611e74866128d9565b8152602081019190915260400160002055600254611ea45760405162461bcd60e51b8152600401610509906131d5565b6040516370a0823160e01b81526000906001600160a01b037f0000000000000000000000007f9adfbd38b669f03d1d11000bc76b9aaea28a8116906370a0823190611ef3903090600401613081565b60206040518083038186803b158015611f0b57600080fd5b505afa158015611f1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f439190612f43565b9050828181611f4e57fe5b046002541115611f705760405162461bcd60e51b8152600401610509906131f2565b81600181905550856001600160a01b03167f095667752957714306e1a6ad83495404412df6fdb932fca6dc849a7ee910d4c186604051611bc991906132a6565b6000807f00000000000000000000000002e7480ffb8fe71d0cbe696e1aa10459affed4206001600160a01b031663d0b06f5d6040518163ffffffff1660e01b815260040160206040518083038186803b15801561200c57600080fd5b505afa158015612020573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120449190612f7e565b63ffffffff1690506000814203905060007f00000000000000000000000002e7480ffb8fe71d0cbe696e1aa10459affed4206001600160a01b03166357806ada6040518163ffffffff1660e01b815260040160206040518083038186803b1580156120ae57600080fd5b505afa1580156120c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120e69190612f43565b905060007f00000000000000000000000002e7480ffb8fe71d0cbe696e1aa10459affed4206001600160a01b031663cab64bcd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561214357600080fd5b505afa158015612157573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061217b9190612f43565b9050821580159061218c5750600081115b8015612231575060007f00000000000000000000000002e7480ffb8fe71d0cbe696e1aa10459affed4206001600160a01b0316633ab04b206040518163ffffffff1660e01b815260040160206040518083038186803b1580156121ee57600080fd5b505afa158015612202573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122269190612edf565b6001600160801b0316115b156122f4576002548302818111156122465750805b6122ee81600160801b7f00000000000000000000000002e7480ffb8fe71d0cbe696e1aa10459affed4206001600160a01b0316633ab04b206040518163ffffffff1660e01b815260040160206040518083038186803b1580156122a857600080fd5b505afa1580156122bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122e09190612edf565b6001600160801b03166128e4565b83019250505b60008060007f000000000000000000000000991d5546c4b442b4c5fdc4c8b8b8d131deb247026001600160a01b03166399fbab888a6040518263ffffffff1660e01b815260040161234591906132a6565b6101806040518083038186803b15801561235e57600080fd5b505afa158015612372573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123969190612fa2565b5050505097509750975050505050506000600560008b815260200190815260200160002054905060007f00000000000000000000000002e7480ffb8fe71d0cbe696e1aa10459affed4206001600160a01b031663a16368c986868a6040518463ffffffff1660e01b815260040161240f93929190613163565b60206040518083038186803b15801561242757600080fd5b505afa15801561243b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061245f9190612f43565b9050600061247d838303856001600160801b0316600160801b6128e4565b9c9b505050505050505050505050565b6000610c8082612993565b60006109758383612997565b606060006124b1836129e1565b9392505050565b60009081526001919091016020526040902054151590565b6000838152600760205260409020544214156124eb5761263d565b7f00000000000000000000000002e7480ffb8fe71d0cbe696e1aa10459affed4206001600160a01b0316631b4109606040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561254657600080fd5b505af115801561255a573d6000803e3d6000fd5b50505060008481526007602052604090204290555061257883611fb0565b6000848152600660205260408082208054909301909255905163a16368c960e01b81526001600160a01b037f00000000000000000000000002e7480ffb8fe71d0cbe696e1aa10459affed420169163a16368c9916125dd918691869190600401613163565b60206040518083038186803b1580156125f557600080fd5b505afa158015612609573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061262d9190612f43565b6000848152600560205260409020555b505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261263d908490612a3d565b60008181526001830160205260408120548015612752578354600019808301910180821461270c5760008660000182815481106126cd57fe5b90600052602060002001549050808760000184815481106126ea57fe5b6000918252602080832090910192909255918252600188019052604090208390555b855486908061271757fe5b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610978565b6000915050610978565b600082600001828154811061276d57fe5b9060005260206000200154905092915050565b600061281682856001600160a01b031663dd62ed3e30876040518363ffffffff1660e01b815260040180836001600160a01b03168152602001826001600160a01b031681526020019250505060206040518083038186803b1580156127e457600080fd5b505afa1580156127f8573d6000803e3d6000fd5b505050506040513d602081101561280e57600080fd5b505190612aee565b604080516001600160a01b038616602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b17905290915061286b908590612a3d565b50505050565b62093a808082069091030190565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261286b908590612a3d565b62093a808106900390565b600080806000198587098686029250828110908390030390508061291a576000841161290f57600080fd5b5082900490506124b1565b80841161292657600080fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b5490565b60006129a383836124b8565b6129d957508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610978565b506000610978565b606081600001805480602002602001604051908101604052809291908181526020018280548015612a3157602002820191906000526020600020905b815481526020019060010190808311612a1d575b50505050509050919050565b6000612a92826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612b489092919063ffffffff16565b80519091501561263d57808060200190516020811015612ab157600080fd5b505161263d5760405162461bcd60e51b815260040180806020018281038252602a815260200180613381602a913960400191505060405180910390fd5b600082820183811015610975576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6060612b578484600085612b5f565b949350505050565b606082471015612ba05760405162461bcd60e51b81526004018080602001828103825260268152602001806133336026913960400191505060405180910390fd5b612ba985612cba565b612bfa576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b60208310612c385780518252601f199092019160209182019101612c19565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612c9a576040519150601f19603f3d011682016040523d82523d6000602084013e612c9f565b606091505b5091509150612caf828286612cc0565b979650505050505050565b3b151590565b60608315612ccf5750816124b1565b825115612cdf5782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612d29578181015183820152602001612d11565b50505050905090810190601f168015612d565780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b8051610c83816132d3565b8051600281900b8114610c8357600080fd5b80516001600160801b0381168114610c8357600080fd5b600060208284031215612da9578081fd5b8135610975816132d3565b600060208284031215612dc5578081fd5b8151610975816132d3565b60008060008060808587031215612de5578283fd5b8435612df0816132d3565b9350602085810135612e01816132d3565b935060408601359250606086013567ffffffffffffffff80821115612e24578384fd5b818801915088601f830112612e37578384fd5b813581811115612e4357fe5b604051601f8201601f1916810185018381118282101715612e6057fe5b60405281815283820185018b1015612e76578586fd5b81858501868301379081019093019390935250939692955090935050565b60008060408385031215612ea6578182fd5b8235612eb1816132d3565b946020939093013593505050565b600060208284031215612ed0578081fd5b81518015158114610975578182fd5b600060208284031215612ef0578081fd5b61097582612d81565b60008060408385031215612f0b578182fd5b612f1483612d81565b9150612f2260208401612d81565b90509250929050565b600060208284031215612f3c578081fd5b5035919050565b600060208284031215612f54578081fd5b5051919050565b60008060408385031215612f6d578182fd5b505080516020909101519092909150565b600060208284031215612f8f578081fd5b815163ffffffff81168114610975578182fd5b6000806000806000806000806000806000806101808d8f031215612fc4578788fd5b8c516bffffffffffffffffffffffff81168114612fdf578889fd5b9b50612fed60208e01612d64565b9a50612ffb60408e01612d64565b995061300960608e01612d64565b985061301760808e01612d6f565b975061302560a08e01612d6f565b965061303360c08e01612d6f565b955061304160e08e01612d81565b94506101008d015193506101208d015192506130606101408e01612d81565b915061306f6101608e01612d81565b90509295989b509295989b509295989b565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b8181101561310a578351835292840192918401916001016130ee565b50909695505050505050565b901515815260200190565b6001600160e01b031991909116815260200190565b600f9390930b8352600291820b6020840152900b604082015260600190565b60029190910b815260200190565b600293840b81529190920b6020820152604081019190915260600190565b6020808252600290820152612d2960f11b604082015260600190565b6020808252600290820152614e4d60f01b604082015260600190565b602080825260029082015261272b60f11b604082015260600190565b6020808252600390820152622d292960e91b604082015260600190565b6020808252600390820152620a4a4960eb1b604082015260600190565b602080825260029082015261504d60f01b604082015260600190565b602080825260029082015261474b60f01b604082015260600190565b6020808252600290820152614e4160f01b604082015260600190565b815181526020808301516001600160a01b0316908201526040808301516001600160801b0390811691830191909152606092830151169181019190915260800190565b90815260200190565b918252602082015260400190565b9283526020830191909152604082015260600190565b6001600160a01b03811681146132e857600080fd5b5056fe5265656e7472616e637947756172643a207265656e7472616e742063616c6c0053616665436173743a2076616c756520646f65736e27742066697420696e203132382062697473416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c53616665436173743a2076616c756520646f65736e27742066697420696e20616e20696e743235365361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220ae0a74b284d73ae1b98b50f379f35cf8b48e131521c85938d48de75685598eef64736f6c63430007060033

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
[ Download: CSV Export  ]
[ Download: CSV Export  ]

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