ETH Price: $2,847.87 (-3.18%)

Contract

0xadf8C1d97cA6d6856407Fb01A7856C8295F9323C

Overview

ETH Balance

0 ETH

ETH Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To

There are no matching entries

Please try again later

Parent Transaction Hash Block From To
View All Internal Transactions

Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Voter

Compiler Version
v0.8.24+commit.e11b9ed9

Optimization Enabled:
Yes with 800 runs

Other Settings:
shanghai EvmVersion
File 1 of 37 : Voter.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.22;

import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol";

import "contracts/interfaces/IFeeDistributor.sol";
import "contracts/interfaces/IFeeDistributorFactory.sol";
import "contracts/interfaces/IGauge.sol";
import "contracts/interfaces/IGaugeFactory.sol";
import "contracts/interfaces/IERC20.sol";
import "contracts/interfaces/IMinter.sol";
import "contracts/interfaces/IPair.sol";
import "contracts/interfaces/IPairFactory.sol";
import "contracts/interfaces/IVoter.sol";
import "contracts/interfaces/IVotingEscrow.sol";
import "contracts/interfaces/IXRam.sol";
import "contracts/interfaces/ICustomGaugeFactory.sol";
import "contracts/interfaces/ICustomGauge.sol";

import "./v2/interfaces/IRamsesV2Factory.sol";
import "./v2-staking/interfaces/IRamsesV2GaugeFactory.sol";
import "./v2-staking/interfaces/INonfungiblePositionManager.sol";
import "./v2/interfaces/pool/IRamsesV2PoolOwnerActions.sol";
import "./v2-staking/interfaces/IGaugeV2.sol";

contract Voter is IVoter, Initializable, ERC1967Upgrade {
    address public _ve; // the ve token that governs these contracts
    address public factory; // the PairFactory
    address public base;
    address public gaugefactory;
    address public feeDistributorFactory;
    uint256 internal constant DURATION = 7 days; // rewards are released over 7 days
    address public minter;
    address public governor; // should be set to an IGovernor
    address public emergencyCouncil; // credibly neutral party similar to Curve's Emergency DAO

    uint256 public totalWeight; // total voting weight

    address[] public pools; // all pools viable for incentives
    mapping(address pool => address gauge) public gauges; // pool => gauge
    mapping(address gauge => address pool) public poolForGauge; // gauge => pool
    mapping(address gauge => address feeDistributor) public feeDistributers; // gauge => internal bribe (only fees)
    mapping(address pool => uint256 weight) public weights; // pool => weight
    mapping(uint256 tokenId => mapping(address pool => uint256 weight))
        public votes; // nft => pool => votes
    mapping(uint256 tokenId => address[] pools) public poolVote; // nft => pools
    mapping(uint256 tokenId => uint256 totalWeight) public usedWeights; // nft => total voting weight of user
    mapping(uint256 tokenId => uint256 time) public lastVoted; // nft => timestamp of last vote, to ensure one vote per epoch
    mapping(address gauge => bool) public isGauge;
    mapping(address token => bool) public isWhitelisted;
    mapping(address gauge => bool) public isAlive;

    uint256 internal _unlocked;

    uint256 internal index;
    mapping(address => uint256) internal supplyIndex;
    mapping(address => uint256) public claimable;

    // Initialize version 2 - CL pools
    address public clFactory;
    address public clGaugeFactory;
    address public nfpManager;

    // Initialize version 3 - xRam
    IXRam public xRam;
    address public whitelistOperator;
    uint256 public constant BASIS = 10000;
    uint256 public xRamRatio; // default xRam ratio
    mapping(address => uint256) _gaugeXRamRatio; // mapping for specific gauge xRam ratios
    mapping(address => bool) _gaugeXRamRatioWritten; // mapping for indicating if a gauge has its own xRam ratio

    // v3.1 Forbid
    // @dev no initialization needed
    mapping(address => bool) public isForbidden;
    // v3.2
    mapping(uint256 tokenId => bool) public partnerNFT;
    mapping(uint256 tokenId => bool) public stale;
    // v3.3 or whatever version we're at now XD, arbitrary gauges
    address public customGaugeFactory;
    mapping(address pool => address customGauge) public customGaugeForPool;

    // End of storage slots //

    ////////////
    // Events //
    ////////////

    event GaugeCreated(
        address indexed gauge,
        address creator,
        address feeDistributor,
        address indexed pool
    );
    event GaugeKilled(address indexed gauge);
    event GaugeRevived(address indexed gauge);
    event Voted(address indexed voter, uint256 tokenId, uint256 weight);
    event Abstained(uint256 tokenId, uint256 weight);
    event Deposit(
        address indexed lp,
        address indexed gauge,
        uint256 tokenId,
        uint256 amount
    );
    event Withdraw(
        address indexed lp,
        address indexed gauge,
        uint256 tokenId,
        uint256 amount
    );
    event NotifyReward(
        address indexed sender,
        address indexed reward,
        uint256 amount
    );
    event DistributeReward(
        address indexed sender,
        address indexed gauge,
        uint256 amount
    );
    event Attach(address indexed owner, address indexed gauge, uint256 tokenId);
    event Detach(address indexed owner, address indexed gauge, uint256 tokenId);
    event Whitelisted(address indexed whitelister, address indexed token);
    event Forbidden(
        address indexed forbidder,
        address indexed token,
        bool status
    );

    event CustomGaugeCreated(
        address indexed gauge,
        address creator,
        address feeDistributor,
        address indexed pool,
        address indexed token
    );

    event XRamRatio(address indexed gauge, uint256 oldRatio, uint256 newRatio);

    //////////////////
    // Initializers //
    //////////////////

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

    /// @notice Returns the initializer version
    function initializedVersion() external view returns (uint8) {
        return _getInitializedVersion();
    }

    function initialize(
        address __ve,
        address _factory,
        address _gauges,
        address _feeDistributorFactory,
        address _minter,
        address _msig,
        address[] memory _tokens
    ) external initializer {
        _ve = __ve;
        factory = _factory;
        base = IVotingEscrow(__ve).token();
        gaugefactory = _gauges;
        feeDistributorFactory = _feeDistributorFactory;
        minter = _minter;
        governor = _msig;
        emergencyCouncil = _msig;

        for (uint256 i = 0; i < _tokens.length; ++i) {
            _whitelist(_tokens[i]);
        }

        _unlocked = 1;
        index = 1;
    }

    /// @notice Initializes the Voter with CL contracts
    function initializeCl(
        address _clFactory,
        address _clGaugeFactory,
        address _nfpManager
    ) external reinitializer(2) {
        require(msg.sender == governor || msg.sender == _getAdmin());

        clFactory = _clFactory;
        clGaugeFactory = _clGaugeFactory;
        nfpManager = _nfpManager;
    }

    /// @notice Initializes xRam, emission ratios, and approvals after the upgrade
    function initializeXRam(address _xRam) external reinitializer(3) {
        require(msg.sender == governor || msg.sender == _getAdmin());

        // set xRam
        xRam = IXRam(_xRam);

        // set emission ratio
        xRamRatio = 5000;
        emit XRamRatio(address(0), 0, 5000);

        // approve xRam to spend Ram
        IERC20(base).approve(address(_xRam), type(uint256).max);

        // approve all gauges to spend xRam
        // only possible on Arbitrum, this block isn't needed for fresh deployments
        uint256 _length = pools.length;
        for (uint256 i = 0; i < _length; ++i) {
            address _gauge = gauges[pools[i]];

            IXRam(_xRam).approve(_gauge, type(uint256).max);
        }
    }

    function initializeCustomGaugeFactory(
        address _factory
    ) external reinitializer(4) {
        customGaugeFactory = _factory;
    }

    function attachPartners(
        uint256[] calldata partners
    ) external reinitializer(5) {
        for (uint i; i < partners.length; i++) {
            IVotingEscrow(_ve).attach(partners[i]);
        }
    }

    ///////////////
    // Modifiers //
    ///////////////

    // simple re-entrancy check
    modifier lock() {
        require(_unlocked == 1);
        _unlocked = 2;
        _;
        _unlocked = 1;
    }

    modifier onlyNewEpoch(uint256 _tokenId) {
        // ensure minter is synced
        require(
            block.timestamp < IMinter(minter).active_period() + 1 weeks,
            "UPDATE_PERIOD"
        );
        _;
    }

    modifier onlyTimelock() {
        require(
            msg.sender == 0x9314fC5633329d285F744108D637E1222CEbae1c,
            "!admin"
        );
        _;
    }

    modifier onlyWhitelistOperators() {
        require(
            msg.sender == whitelistOperator || msg.sender == governor,
            "auth"
        );
        _;
    }

    ////////////////////////////////
    // Governance Gated Functions //
    ////////////////////////////////

    function setGovernor(address _governor) public {
        require(msg.sender == governor);
        governor = _governor;
    }

    function setEmergencyCouncil(address _council) public {
        require(msg.sender == emergencyCouncil);
        emergencyCouncil = _council;
    }

    function setWhitelistOperator(address _whitelistOperator) public {
        require(msg.sender == governor);
        whitelistOperator = _whitelistOperator;
    }

    /// @notice sets the default xRamRatio
    function setXRamRatio(uint256 _xRamRatio) external onlyWhitelistOperators {
        require(_xRamRatio <= BASIS, ">100%");

        emit XRamRatio(address(0), xRamRatio, _xRamRatio);
        xRamRatio = _xRamRatio;
    }

    /// @notice sets the xRamRatio of specifics gauges
    function setGaugeXRamRatio(
        address[] calldata _gauges,
        uint256[] calldata _xRamRatios
    ) external onlyWhitelistOperators {
        uint256 _length = _gauges.length;
        require(_length == _xRamRatios.length, "length mismatch");

        for (uint256 i = 0; i < _length; ++i) {
            uint256 _xRamRatio = _xRamRatios[i];
            require(_xRamRatio <= BASIS, ">100%");

            // fetch old xRam ratio for later event
            address _gauge = _gauges[i];
            uint256 oldXRamRatio = gaugeXRamRatio(_gauge);

            // write gauge specific xRam ratio
            _gaugeXRamRatio[_gauge] = _xRamRatio;
            _gaugeXRamRatioWritten[_gauge] = true;

            emit XRamRatio(_gauge, oldXRamRatio, _xRamRatio);
        }
    }

    /// @notice resets the xRamRatio of specifics gauges back to default
    function resetGaugeXRamRatio(
        address[] calldata _gauges
    ) external onlyWhitelistOperators {
        uint256 _xRamRatio = xRamRatio;
        uint256 _length = _gauges.length;
        for (uint256 i = 0; i < _length; ++i) {
            // fetch old xRam ratio for later event
            address _gauge = _gauges[i];
            uint256 oldXRamRatio = gaugeXRamRatio(_gauge);

            // reset _gaugeXRamRatioWritten
            _gaugeXRamRatioWritten[_gauge] = false;
            // it's ok to leave _gaugeXRamRatio dirty, it's going to be overwriten when it's activated again

            emit XRamRatio(_gauge, oldXRamRatio, _xRamRatio);
        }
    }

    function whitelist(address _token) public onlyWhitelistOperators {
        _whitelist(_token);
    }

    function forbid(
        address _token,
        bool _status
    ) public onlyWhitelistOperators {
        _forbid(_token, _status);
    }

    function _whitelist(address _token) internal {
        require(!isWhitelisted[_token]);
        isWhitelisted[_token] = true;
        emit Whitelisted(msg.sender, _token);
    }

    function _forbid(address _token, bool _status) internal {
        // forbid can happen before whitelisting
        if (isForbidden[_token] != _status) {
            isForbidden[_token] = _status;
            emit Forbidden(msg.sender, _token, _status);
        }
    }

    function killGauge(address _gauge) external onlyWhitelistOperators {
        require(isAlive[_gauge], "gauge already dead");
        isAlive[_gauge] = false;
        address pool = poolForGauge[_gauge];

        // we call a function that doesn't exist in a CL pool to confirm that it is a legacy pool
        (bool success, ) = pool.staticcall(
            abi.encodeWithSelector(IPair.feeSplit.selector)
        );

        // If it is a legacy pool we set activeGauge to false so most fees are compounded into the pool
        if (success) {
            IPair(pool).setActiveGauge(false);
        }

        emit GaugeKilled(_gauge);
    }

    function reviveGauge(address _gauge) external onlyWhitelistOperators {
        require(!isAlive[_gauge], "gauge already alive");
        isAlive[_gauge] = true;
        address pool = poolForGauge[_gauge];

        // we call a function that doesn't exist in a CL pool to confirm that it is a legacy pool
        (bool success, ) = pool.staticcall(
            abi.encodeWithSelector(IPair.feeSplit.selector)
        );

        // If it is a legacy pool we set activeGauge to false so most fees are compounded into the pool
        if (success) {
            IPair(pool).setActiveGauge(true);
        }

        emit GaugeRevived(_gauge);
    }

    function whitelistGaugeRewards(
        address[] calldata _gauges,
        address[] calldata _rewards
    ) external onlyWhitelistOperators {
        for (uint256 i; i < _gauges.length; ++i) {
            IGauge(_gauges[i]).whitelistNotifiedRewards(_rewards[i]);
        }
    }

    function removeGaugeRewards(
        address[] calldata _gauges,
        address[] calldata _rewards
    ) external onlyWhitelistOperators {
        for (uint256 i; i < _gauges.length; ++i) {
            IGauge(_gauges[i]).removeRewardWhitelist(_rewards[i]);
        }
    }

    /// @notice clawback claimable for dead gauges to treasury
    function clawBackUnusedEmissions(
        address[] calldata _gauges
    ) external onlyWhitelistOperators {
        IMinter(minter).update_period();

        for (uint256 i; i < _gauges.length; i++) {
            _updateFor(_gauges[i]);

            if (!isAlive[_gauges[i]]) {
                uint256 _claimable = claimable[_gauges[i]];
                delete claimable[_gauges[i]];
                if (_claimable > 0) {
                    IERC20(base).transfer(governor, _claimable);
                }
            }
        }
    }

    /// @notice force reset votes for tokenIds
    function resetVotes(
        uint256[] calldata tokenIds
    ) external onlyWhitelistOperators {
        require(
            block.timestamp < IMinter(minter).active_period() + 1 weeks,
            "UPDATE_PERIOD"
        );

        for (uint256 i; i < tokenIds.length; i++) {
            lastVoted[tokenIds[i]] = (block.timestamp / DURATION) * DURATION;
            _reset(tokenIds[i]);
            IVotingEscrow(_ve).abstain(tokenIds[i]);
        }
    }

    /// @notice ungated
    function syncLegacyGaugeRewards(address[] calldata _gauges) external {
        address _xRam = address(xRam);

        for (uint256 i; i < _gauges.length; i++) {
            IGauge(_gauges[i]).whitelistNotifiedRewards(_xRam);
        }
    }

    function addClGaugeReward(
        address gauge,
        address reward
    ) external onlyWhitelistOperators {
        IGaugeV2(gauge).addRewards(reward);
    }

    function removeClGaugeReward(
        address gauge,
        address reward
    ) external onlyWhitelistOperators {
        IGaugeV2(gauge).removeRewards(reward);
    }

    ////////////
    // Voting //
    ////////////

    function reset(uint256 _tokenId) external onlyNewEpoch(_tokenId) {
        require(
            IVotingEscrow(_ve).isApprovedOrOwner(msg.sender, _tokenId),
            "!approved"
        );
        lastVoted[_tokenId] = (block.timestamp / DURATION) * DURATION;
        _reset(_tokenId);
        IVotingEscrow(_ve).abstain(_tokenId);
    }

    function _reset(uint256 _tokenId) internal {
        address[] storage _poolVote = poolVote[_tokenId];
        uint256 _poolVoteCnt = _poolVote.length;
        uint256 _totalWeight = 0;

        for (uint256 i = 0; i < _poolVoteCnt; ++i) {
            address _pool = _poolVote[i];
            uint256 _votes = votes[_tokenId][_pool];

            if (_votes != 0) {
                _updateFor(gauges[_pool]);
                weights[_pool] -= _votes;
                votes[_tokenId][_pool] -= _votes;
                if (_votes > 0) {
                    IFeeDistributor(feeDistributers[gauges[_pool]])._withdraw(
                        uint256(_votes),
                        _tokenId
                    );
                    _totalWeight += _votes;
                } else {
                    _totalWeight -= _votes;
                }
                emit Abstained(_tokenId, _votes);
            }
        }
        totalWeight -= uint256(_totalWeight);
        usedWeights[_tokenId] = 0;
        delete poolVote[_tokenId];
    }

    function poke(uint256 _tokenId) external {
        address[] memory _poolVote = poolVote[_tokenId];
        uint256 _poolCnt = _poolVote.length;
        uint256[] memory _weights = new uint256[](_poolCnt);

        for (uint256 i = 0; i < _poolCnt; ++i) {
            _weights[i] = votes[_tokenId][_poolVote[i]];
        }

        _vote(_tokenId, _poolVote, _weights);
    }

    function _vote(
        uint256 _tokenId,
        address[] memory _poolVote,
        uint256[] memory _weights
    ) internal {
        require(!stale[_tokenId], "Stale NFT, please contact the team");

        _reset(_tokenId);
        uint256 _poolCnt = _poolVote.length;
        uint256 _weight = IVotingEscrow(_ve).balanceOfNFT(_tokenId);
        uint256 _totalVoteWeight = 0;
        uint256 _totalWeight = 0;
        uint256 _usedWeight = 0;

        for (uint256 i = 0; i < _poolCnt; ++i) {
            _totalVoteWeight += _weights[i];
        }

        for (uint256 i = 0; i < _poolCnt; ++i) {
            address _pool = _poolVote[i];
            address _gauge = gauges[_pool];

            if (isGauge[_gauge] && isAlive[_gauge]) {
                uint256 _poolWeight = (_weights[i] * _weight) /
                    _totalVoteWeight;
                require(votes[_tokenId][_pool] == 0);
                require(_poolWeight != 0);
                _updateFor(_gauge);

                poolVote[_tokenId].push(_pool);

                weights[_pool] += _poolWeight;
                votes[_tokenId][_pool] += _poolWeight;
                IFeeDistributor(feeDistributers[_gauge])._deposit(
                    uint256(_poolWeight),
                    _tokenId
                );
                _usedWeight += _poolWeight;
                _totalWeight += _poolWeight;
                emit Voted(msg.sender, _tokenId, _poolWeight);
            }
        }
        if (_usedWeight > 0) IVotingEscrow(_ve).voting(_tokenId);
        totalWeight += uint256(_totalWeight);
        usedWeights[_tokenId] = uint256(_usedWeight);
    }

    function vote(
        uint256 tokenId,
        address[] calldata _poolVote,
        uint256[] calldata _weights
    ) external onlyNewEpoch(tokenId) {
        require(
            IVotingEscrow(_ve).isApprovedOrOwner(msg.sender, tokenId),
            "!approved"
        );
        require(_poolVote.length == _weights.length);
        lastVoted[tokenId] = (block.timestamp / DURATION) * DURATION;
        _vote(tokenId, _poolVote, _weights);
    }

    ////////////////////
    // Gauge Creation //
    ////////////////////
    function createGauge(address _pool) external returns (address) {
        require(gauges[_pool] == address(0x0), "exists");
        bool isPair = IPairFactory(factory).isPair(_pool);
        require(isPair, "!_pool");
        address[] memory allowedRewards;
        address tokenA;
        address tokenB;

        if (isPair) {
            (tokenA, tokenB) = IPair(_pool).tokens();

            if (tokenA == base || tokenB == base) {
                allowedRewards = new address[](3);
                allowedRewards[0] = base;
                allowedRewards[1] = address(xRam);
                allowedRewards[2] = tokenA == base ? tokenB : tokenA;
            } else {
                allowedRewards = new address[](4);
                allowedRewards[0] = base;
                allowedRewards[1] = address(xRam);
                allowedRewards[2] = tokenA;
                allowedRewards[3] = tokenB;
            }
        }

        if (msg.sender != governor) {
            // prevent gauge creation for forbidden tokens
            require(!isForbidden[tokenA] && !isForbidden[tokenB], "Forbidden");
            require(
                isWhitelisted[tokenA] && isWhitelisted[tokenB],
                "!whitelisted"
            );
        }

        address _feeDistributor = IFeeDistributorFactory(feeDistributorFactory)
            .createFeeDistributor(_pool);
        address _gauge = IGaugeFactory(gaugefactory).createGauge(
            _pool,
            _feeDistributor,
            _ve,
            isPair,
            allowedRewards
        );

        IERC20(base).approve(_gauge, type(uint256).max);
        xRam.approve(_gauge, type(uint256).max);
        feeDistributers[_gauge] = _feeDistributor;
        gauges[_pool] = _gauge;
        poolForGauge[_gauge] = _pool;
        isGauge[_gauge] = true;
        isAlive[_gauge] = true;
        _updateFor(_gauge);
        pools.push(_pool);
        IPair(_pool).setActiveGauge(true);
        emit GaugeCreated(_gauge, msg.sender, _feeDistributor, _pool);
        return _gauge;
    }

    function createCLGauge(
        address tokenA,
        address tokenB,
        uint24 fee
    ) external returns (address) {
        address _pool = IRamsesV2Factory(clFactory).getPool(
            tokenA,
            tokenB,
            fee
        );
        require(_pool != address(0), "no pool");
        require(gauges[_pool] == address(0x0), "exists");

        if (msg.sender != governor) {
            // gov can create for any cl pool, even non-Ramses pairs
            // for arbitrary gauges without a pool, use createGauge()

            // prevent gauge creation for forbidden tokens
            require(!isForbidden[tokenA] && !isForbidden[tokenB], "Forbidden");
            require(
                isWhitelisted[tokenA] && isWhitelisted[tokenB],
                "!whitelisted"
            );
        }

        address _feeDistributor = IFeeDistributorFactory(feeDistributorFactory)
            .createFeeDistributor(_pool);
        // return address(0);
        address _gauge = IRamsesV2GaugeFactory(clGaugeFactory).createGauge(
            _pool
        );

        IERC20(base).approve(_gauge, type(uint256).max);
        xRam.approve(_gauge, type(uint256).max);
        feeDistributers[_gauge] = _feeDistributor;
        gauges[_pool] = _gauge;
        poolForGauge[_gauge] = _pool;
        isGauge[_gauge] = true;
        isAlive[_gauge] = true;
        _updateFor(_gauge);
        pools.push(_pool);

        IRamsesV2PoolOwnerActions(_pool).setFeeProtocol();

        emit GaugeCreated(_gauge, msg.sender, _feeDistributor, _pool);
        return _gauge;
    }

    function createCustomGauge(
        address _token,
        address _pool,
        address[] calldata whitelistedRewards
    ) external returns (address) {
        require(msg.sender == governor, "!AUTH");

        address _feeDistributor = IFeeDistributorFactory(feeDistributorFactory)
            .createFeeDistributor(_token);

        address _gauge = ICustomGaugeFactory(customGaugeFactory)
            .createCustomGauge(_token);

        for (uint256 i; i < whitelistedRewards.length; i++) {
            ICustomGauge(_gauge).whitelistReward(whitelistedRewards[i]);
        }

        IERC20(base).approve(_gauge, type(uint256).max);
        xRam.approve(_gauge, type(uint256).max);
        feeDistributers[_gauge] = _feeDistributor;
        gauges[_token] = _gauge;
        poolForGauge[_gauge] = _token;
        isGauge[_gauge] = true;
        isAlive[_gauge] = true;
        _updateFor(_gauge);
        pools.push(_token);
        if (_pool != address(0)) {
            require(!isAlive[gauges[_pool]], "Active gauge");
            require(customGaugeForPool[_pool] == address(0), "exists");
            customGaugeForPool[_pool] = _gauge;
        }
        emit CustomGaugeCreated(
            _gauge,
            msg.sender,
            _feeDistributor,
            _pool,
            _token
        );
        return _gauge;
    }

    ///@dev designates a partner veNFT as stale
    function designateStale(
        uint256 _tokenId,
        bool _status
    ) external onlyWhitelistOperators {
        require(partnerNFT[_tokenId] == true, "!P");
        stale[_tokenId] = _status;
        _reset(_tokenId);
    }

    ///@dev designates a veNFT as a partner veNFT
    function designatePartnerNFT(
        uint256 _tokenId,
        bool _status
    ) external onlyWhitelistOperators {
        if (!_status && stale[_tokenId]) {
            stale[_tokenId] = false;
        }

        if (_status && !partnerNFT[_tokenId]) {
            IVotingEscrow(_ve).attach(_tokenId);
        } else if (!_status && partnerNFT[_tokenId]) {
            IVotingEscrow(_ve).detach(_tokenId);
        }

        partnerNFT[_tokenId] = _status;
    }

    function detachPartner(uint256 _tokenId) external onlyWhitelistOperators {
        IVotingEscrow(_ve).detach(_tokenId);
    }

    ////////////////////
    // Event Emitters //
    ////////////////////
    function attachTokenToGauge(uint256 tokenId, address account) external {
        require(isGauge[msg.sender] || isGauge[gauges[msg.sender]]);
        require(isAlive[msg.sender] || isGauge[gauges[msg.sender]]); // killed gauges cannot attach tokens to themselves
        if (tokenId > 0) IVotingEscrow(_ve).attach(tokenId);
        emit Attach(account, msg.sender, tokenId);
    }

    function emitDeposit(
        uint256 tokenId,
        address account,
        uint256 amount
    ) external {
        require(isGauge[msg.sender]);
        require(isAlive[msg.sender]);
        emit Deposit(account, msg.sender, tokenId, amount);
    }

    function detachTokenFromGauge(uint256 tokenId, address account) external {
        require(isGauge[msg.sender] || isGauge[gauges[msg.sender]]);
        if (tokenId > 0) IVotingEscrow(_ve).detach(tokenId);
        emit Detach(account, msg.sender, tokenId);
    }

    function emitWithdraw(
        uint256 tokenId,
        address account,
        uint256 amount
    ) external {
        require(isGauge[msg.sender]);
        emit Withdraw(account, msg.sender, tokenId, amount);
    }

    /////////////////////////////
    // One-stop Reward Claimer //
    /////////////////////////////

    function claimClGaugeRewards(
        address[] calldata _gauges,
        address[][] calldata _tokens,
        uint256[][] calldata _nfpTokenIds
    ) external {
        address _nfpManager = nfpManager;
        for (uint256 i = 0; i < _gauges.length; ++i) {
            for (uint256 j = 0; j < _nfpTokenIds[i].length; ++j) {
                require(
                    msg.sender ==
                        INonfungiblePositionManager(_nfpManager).ownerOf(
                            _nfpTokenIds[i][j]
                        ) ||
                        msg.sender ==
                        INonfungiblePositionManager(_nfpManager).getApproved(
                            _nfpTokenIds[i][j]
                        )
                );
                IFeeDistributor(_gauges[i]).getRewardForOwner(
                    _nfpTokenIds[i][j],
                    _tokens[i]
                );
            }
        }
    }

    function claimBribes(
        address[] memory _bribes,
        address[][] memory _tokens,
        uint256 _tokenId
    ) external {
        require(IVotingEscrow(_ve).isApprovedOrOwner(msg.sender, _tokenId));
        for (uint256 i = 0; i < _bribes.length; ++i) {
            IFeeDistributor(_bribes[i]).getRewardForOwner(_tokenId, _tokens[i]);
        }
    }

    function claimFees(
        address[] memory _fees,
        address[][] memory _tokens,
        uint256 _tokenId
    ) external {
        require(IVotingEscrow(_ve).isApprovedOrOwner(msg.sender, _tokenId));
        for (uint256 i = 0; i < _fees.length; ++i) {
            IFeeDistributor(_fees[i]).getRewardForOwner(_tokenId, _tokens[i]);
        }
    }

    function claimRewards(
        address[] memory _gauges,
        address[][] memory _tokens
    ) external {
        for (uint256 i = 0; i < _gauges.length; i++) {
            IGauge(_gauges[i]).getReward(msg.sender, _tokens[i]);
        }
    }

    //////////////////////////
    // Emission Calculation //
    //////////////////////////

    function notifyRewardAmount(uint256 amount) external {
        if (totalWeight > 0) {
            _safeTransferFrom(base, msg.sender, address(this), amount); // transfer the distro in
            uint256 _ratio = (amount * 1e18) / totalWeight; // 1e18 adjustment is removed during claim
            if (_ratio > 0) {
                index += _ratio;
            }
            emit NotifyReward(msg.sender, base, amount);
        }
    }

    function updateFor(address[] memory _gauges) external {
        for (uint256 i = 0; i < _gauges.length; ++i) {
            _updateFor(_gauges[i]);
        }
    }

    function updateForRange(uint256 start, uint256 end) public {
        for (uint256 i = start; i < end; ++i) {
            _updateFor(gauges[pools[i]]);
        }
    }

    function updateAll() external {
        updateForRange(0, pools.length);
    }

    function updateGauge(address _gauge) external {
        _updateFor(_gauge);
    }

    function _updateFor(address _gauge) internal {
        address _pool = poolForGauge[_gauge];
        uint256 _supplied = weights[_pool];
        uint256 _supplyIndex = supplyIndex[_gauge];

        // only new pools will have 0 _supplyIndex
        if (_supplyIndex > 0) {
            uint256 _index = index; // get global index0 for accumulated distro
            supplyIndex[_gauge] = _index; // update _gauge current position to global position
            uint256 _delta = _index - _supplyIndex; // see if there is any difference that need to be accrued
            if (_delta > 0 && _supplied > 0) {
                uint256 _share = (uint256(_supplied) * _delta) / 1e18; // add accrued difference for each supplied token
                claimable[_gauge] += _share;
            }
        } else {
            supplyIndex[_gauge] = index; // new users are set to the default global state
        }
    }

    ///////////////////////////
    // Emission Distribution //
    ///////////////////////////

    function distributeFees(address[] memory _gauges) external {
        for (uint256 i = 0; i < _gauges.length; ++i) {
            if (IGauge(_gauges[i]).isForPair()) {
                IGauge(_gauges[i]).claimFees();
            }
        }
    }

    function distribute(address _gauge) public lock {
        IMinter(minter).update_period();
        _updateFor(_gauge);

        // dead gauges should be handled by a different function
        if (isAlive[_gauge]) {
            uint256 _claimable = claimable[_gauge];

            if (_claimable == 0) {
                return;
            }

            // calculate _xRamClaimable
            address _xRam = address(xRam);
            uint256 _xRamClaimable = (_claimable * gaugeXRamRatio(_gauge)) /
                BASIS;
            _claimable -= _xRamClaimable;

            // can only distribute if the distributed amount / week > 0 and is > left()
            bool canDistribute = true;

            // _claimable could be 0 if emission is 100% xRAM
            if (_claimable > 0) {
                if (
                    _claimable / DURATION == 0 ||
                    _claimable < IGauge(_gauge).left(base)
                ) {
                    canDistribute = false;
                }
            }
            // _xRamClaimable could be 0 if emission is 100% RAM
            if (_xRamClaimable > 0) {
                if (
                    _xRamClaimable / DURATION == 0 ||
                    _xRamClaimable < IGauge(_gauge).left(_xRam)
                ) {
                    canDistribute = false;
                }
            }

            if (canDistribute) {
                // reset claimable
                claimable[_gauge] = 0;

                if (_claimable > 0) {
                    // notify RAM
                    IGauge(_gauge).notifyRewardAmount(base, _claimable);
                }

                if (_xRamClaimable > 0) {
                    // convert, then notify xRAM
                    IXRam(_xRam).convertRam(_xRamClaimable);
                    IGauge(_gauge).notifyRewardAmount(_xRam, _xRamClaimable);
                }

                emit DistributeReward(
                    msg.sender,
                    _gauge,
                    _claimable + _xRamClaimable
                );
            }
        }
    }

    function distributeAll() external {
        distributeByRange(0, pools.length);
    }

    function distributeByRange(uint256 start, uint256 finish) public {
        for (uint256 x = start; x < finish; x++) {
            distribute(gauges[pools[x]]);
        }
    }

    function distributeByGauge(address[] memory _gauges) external {
        for (uint256 x = 0; x < _gauges.length; x++) {
            distribute(_gauges[x]);
        }
    }

    ////////////////////
    // View Functions //
    ////////////////////
    function length() external view returns (uint256) {
        return pools.length;
    }

    function getVotes(
        uint256 fromTokenId,
        uint256 toTokenId
    )
        external
        view
        returns (
            address[][] memory tokensVotes,
            uint256[][] memory tokensWeights
        )
    {
        uint256 tokensCount = toTokenId - fromTokenId + 1;
        tokensVotes = new address[][](tokensCount);
        tokensWeights = new uint256[][](tokensCount);
        for (uint256 i = 0; i < tokensCount; ++i) {
            uint256 tokenId = fromTokenId + i;
            tokensVotes[i] = new address[](poolVote[tokenId].length);
            tokensVotes[i] = poolVote[tokenId];

            tokensWeights[i] = new uint256[](poolVote[tokenId].length);
            for (uint256 j = 0; j < tokensVotes[i].length; ++j) {
                tokensWeights[i][j] = votes[tokenId][tokensVotes[i][j]];
            }
        }
    }

    function xRamAddress() external view returns (address _xRamAddress) {
        _xRamAddress = address(xRam);
    }

    /// @notice returns the xRamRatio applicable to a gauge
    /// @dev for default ratios, call this with address(0) or call xRamRatio
    function gaugeXRamRatio(address gauge) public view returns (uint256) {
        // return gauge specific xRam Ratio if writter
        if (_gaugeXRamRatioWritten[gauge]) {
            return _gaugeXRamRatio[gauge];
        }

        // otherwise return default xRamRatio
        return xRamRatio;
    }

    //////////////////////
    // safeTransferFrom //
    //////////////////////

    function _safeTransferFrom(
        address token,
        address from,
        address to,
        uint256 value
    ) internal {
        require(token.code.length > 0);
        (bool success, bytes memory data) = token.call(
            abi.encodeWithSelector(
                IERC20.transferFrom.selector,
                from,
                to,
                value
            )
        );
        require(success && (data.length == 0 || abi.decode(data, (bool))));
    }
}

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

pragma solidity ^0.8.0;

import "../IERC721Upgradeable.sol";

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

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

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

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

pragma solidity ^0.8.0;

import "../IERC721Upgradeable.sol";

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)

pragma solidity ^0.8.0;

/**
 * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified
 * proxy whose upgrades are fully controlled by the current implementation.
 */
interface IERC1822Proxiable {
    /**
     * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation
     * address.
     *
     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
     * function revert if invoked through a proxy.
     */
    function proxiableUUID() external view returns (bytes32);
}

File 7 of 37 : IERC1967.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)

pragma solidity ^0.8.0;

/**
 * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.
 *
 * _Available since v4.8.3._
 */
interface IERC1967 {
    /**
     * @dev Emitted when the implementation is upgraded.
     */
    event Upgraded(address indexed implementation);

    /**
     * @dev Emitted when the admin account has changed.
     */
    event AdminChanged(address previousAdmin, address newAdmin);

    /**
     * @dev Emitted when the beacon is changed.
     */
    event BeaconUpgraded(address indexed beacon);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)

pragma solidity ^0.8.0;

/**
 * @dev This is the interface that {BeaconProxy} expects of its beacon.
 */
interface IBeacon {
    /**
     * @dev Must return an address that can be used as a delegate call target.
     *
     * {BeaconProxy} will check that this address is a contract.
     */
    function implementation() external view returns (address);
}

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

pragma solidity ^0.8.2;

import "../beacon/IBeacon.sol";
import "../../interfaces/IERC1967.sol";
import "../../interfaces/draft-IERC1822.sol";
import "../../utils/Address.sol";
import "../../utils/StorageSlot.sol";

/**
 * @dev This abstract contract provides getters and event emitting update functions for
 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
 *
 * _Available since v4.1._
 */
abstract contract ERC1967Upgrade is IERC1967 {
    // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1
    bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;

    /**
     * @dev Storage slot with the address of the current implementation.
     * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

    /**
     * @dev Returns the current implementation address.
     */
    function _getImplementation() internal view returns (address) {
        return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 implementation slot.
     */
    function _setImplementation(address newImplementation) private {
        require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
        StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
    }

    /**
     * @dev Perform implementation upgrade
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeTo(address newImplementation) internal {
        _setImplementation(newImplementation);
        emit Upgraded(newImplementation);
    }

    /**
     * @dev Perform implementation upgrade with additional setup call.
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {
        _upgradeTo(newImplementation);
        if (data.length > 0 || forceCall) {
            Address.functionDelegateCall(newImplementation, data);
        }
    }

    /**
     * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {
        // Upgrades from old implementations will perform a rollback test. This test requires the new
        // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing
        // this special case will break upgrade paths from old UUPS implementation to new ones.
        if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {
            _setImplementation(newImplementation);
        } else {
            try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {
                require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID");
            } catch {
                revert("ERC1967Upgrade: new implementation is not UUPS");
            }
            _upgradeToAndCall(newImplementation, data, forceCall);
        }
    }

    /**
     * @dev Storage slot with the admin of the contract.
     * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;

    /**
     * @dev Returns the current admin.
     */
    function _getAdmin() internal view returns (address) {
        return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 admin slot.
     */
    function _setAdmin(address newAdmin) private {
        require(newAdmin != address(0), "ERC1967: new admin is the zero address");
        StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;
    }

    /**
     * @dev Changes the admin of the proxy.
     *
     * Emits an {AdminChanged} event.
     */
    function _changeAdmin(address newAdmin) internal {
        emit AdminChanged(_getAdmin(), newAdmin);
        _setAdmin(newAdmin);
    }

    /**
     * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
     * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.
     */
    bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;

    /**
     * @dev Returns the current beacon.
     */
    function _getBeacon() internal view returns (address) {
        return StorageSlot.getAddressSlot(_BEACON_SLOT).value;
    }

    /**
     * @dev Stores a new beacon in the EIP1967 beacon slot.
     */
    function _setBeacon(address newBeacon) private {
        require(Address.isContract(newBeacon), "ERC1967: new beacon is not a contract");
        require(
            Address.isContract(IBeacon(newBeacon).implementation()),
            "ERC1967: beacon implementation is not a contract"
        );
        StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;
    }

    /**
     * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does
     * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).
     *
     * Emits a {BeaconUpgraded} event.
     */
    function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {
        _setBeacon(newBeacon);
        emit BeaconUpgraded(newBeacon);
        if (data.length > 0 || forceCall) {
            Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);
        }
    }
}

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

pragma solidity ^0.8.2;

import "../../utils/Address.sol";

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

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

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

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

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

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1, "Math: mulDiv overflow");

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

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

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

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

            // Shift in bits from prod1 into prod0.
            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 for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

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

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10 ** 64) {
                value /= 10 ** 64;
                result += 64;
            }
            if (value >= 10 ** 32) {
                value /= 10 ** 32;
                result += 32;
            }
            if (value >= 10 ** 16) {
                value /= 10 ** 16;
                result += 16;
            }
            if (value >= 10 ** 8) {
                value /= 10 ** 8;
                result += 8;
            }
            if (value >= 10 ** 4) {
                value /= 10 ** 4;
                result += 4;
            }
            if (value >= 10 ** 2) {
                value /= 10 ** 2;
                result += 2;
            }
            if (value >= 10 ** 1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
        }
    }
}

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

pragma solidity ^0.8.0;

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 *
 * Example usage to set ERC1967 implementation slot:
 * ```solidity
 * contract ERC1967 {
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 *
 * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._
 * _Available since v4.9 for `string`, `bytes`._
 */
library StorageSlot {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    struct StringSlot {
        string value;
    }

    struct BytesSlot {
        bytes value;
    }

    /**
     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
     */
    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.
     */
    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
     */
    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.
     */
    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` with member `value` located at `slot`.
     */
    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` representation of the string storage pointer `store`.
     */
    function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` with member `value` located at `slot`.
     */
    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
     */
    function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }
}

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

interface ICustomGauge {
    error ZeroAmount();

    error NotifyStakingToken();

    error RewardTooHigh();

    error NotWhitelisted();

    error Unauthorized();

    event Deposit(address indexed from, uint256 amount);

    event Withdraw(address indexed from, uint256 amount);

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

    event ClaimRewards(
        address indexed from,
        address indexed reward,
        uint256 amount
    );

    event RewardWhitelisted(address indexed reward, bool whitelisted);

    function initialize(address _stake, address _voter) external;

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

    function rewardsListLength() external view returns (uint256);

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

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

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

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

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

    function depositAll() external;

    function deposit(uint256 amount) external;

    function withdrawAll() external;

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

    function whitelistReward(address _reward) external;

    function removeRewardWhitelist(address _reward) external;

    function notifyRewardAmount(address token, uint256 amount) external;

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

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

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

interface ICustomGaugeFactory {
    function createCustomGauge(address _pool) external returns (address);
}

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

interface IERC20 {
    function totalSupply() external view returns (uint256);
    function transfer(address recipient, uint amount) external returns (bool);
    function decimals() external view returns (uint8);
    function symbol() external view returns (string memory);
    function balanceOf(address) external view returns (uint);
    function transferFrom(address sender, address recipient, uint amount) external returns (bool);
    function allowance(address owner, address spender) external view returns (uint);
    function approve(address spender, uint value) external returns (bool);

    event Transfer(address indexed from, address indexed to, uint value);
    event Approval(address indexed owner, address indexed spender, uint value);
}

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

interface IFeeDistributor {
    function _deposit(uint256 amount, uint256 tokenId) external;

    function _withdraw(uint256 amount, uint256 tokenId) external;

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

    function notifyRewardAmount(address token, uint256 amount) external;

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

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

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

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

interface IFeeDistributorFactory {
    function createFeeDistributor(address) external returns (address);
}

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

interface IGauge {
    function notifyRewardAmount(address token, uint amount) external;

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

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

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

    function isForPair() external view returns (bool);

    function whitelistNotifiedRewards(address token) external;

    function removeRewardWhitelist(address token) external;

    function rewardsListLength() external view returns (uint256);

    function rewards(uint256 index) external view returns (address);

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

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

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

    function rewardRate(address) external view returns (uint256);
}

File 20 of 37 : IGaugeFactory.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

interface IGaugeFactory {
    function createGauge(
        address,
        address,
        address,
        bool,
        address[] memory
    ) external returns (address);
}

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

import "contracts/interfaces/IRewardsDistributor.sol";

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

    function active_period() external view returns (uint256);

    function _rewards_distributor() external view returns (IRewardsDistributor);

    function updateIncentivesSize(uint256 _newSize) external;

    function updateRate(uint256 _newRate) external;

    function updateGrowth(uint256 _newGrowth) external;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

    function fees() external view returns (address);

    function setActiveGauge(bool isActive) external;

    function setFeeSplit() external;

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

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

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

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

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

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

    function pairCodeHash() external view returns (bytes32);

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

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

    function voter() external view returns (address);

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

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

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

    function treasury() external view returns (address);

    function acceptFeeManager() external;

    function setPairFee(address _pair, uint256 _fee) external;

    function setFee(bool _stable, uint256 _fee) external;

    function feeSplit() external view returns (uint8);

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

    function setFeeSplit(uint8 _toFees, uint8 _toTreasury) external;

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

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

interface IRewardsDistributor {
    function checkpoint_token() external;

    function checkpoint_total_supply() external;

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

File 25 of 37 : IVoter.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6 || ^0.8.13;
pragma abicoder v2;

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

    function governor() external view returns (address);

    function emergencyCouncil() external view returns (address);

    function attachTokenToGauge(uint256 _tokenId, address account) external;

    function detachTokenFromGauge(uint256 _tokenId, address account) external;

    function emitDeposit(
        uint256 _tokenId,
        address account,
        uint256 amount
    ) external;

    function emitWithdraw(
        uint256 _tokenId,
        address account,
        uint256 amount
    ) external;

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

    function notifyRewardAmount(uint256 amount) external;

    function distribute(address _gauge) external;

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

    function feeDistributers(
        address gauge
    ) external view returns (address feeDistributor);

    function gaugefactory() external view returns (address);

    function feeDistributorFactory() external view returns (address);

    function minter() external view returns (address);

    function factory() external view returns (address);

    function length() external view returns (uint256);

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

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

    function stale(uint256 tokenId) external view returns (bool);

    function partnerNFT(uint256 tokenId) external view returns (bool);

    function setXRamRatio(uint256 _xRamRatio) external;

    function setGaugeXRamRatio(
        address[] calldata _gauges,
        uint256[] calldata _xRamRatios
    ) external;

    function resetGaugeXRamRatio(address[] calldata _gauges) external;

    function whitelist(address _token) external;

    function forbid(address _token, bool _status) external;

    function killGauge(address _gauge) external;

    function reviveGauge(address _gauge) external;

    function whitelistOperator() external view returns (address);

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

    function clawBackUnusedEmissions(address[] calldata _gauges) external;

    function resetVotes(uint256[] calldata tokenIds) external;

    function syncLegacyGaugeRewards(address[] calldata _gauges) external;

    function whitelistGaugeRewards(
        address[] calldata _gauges,
        address[] calldata _rewards
    ) external;

    function removeGaugeRewards(
        address[] calldata _gauges,
        address[] calldata _rewards
    ) external;

    function base() external view returns (address ram);

    function xRamAddress() external view returns (address _xRamAddress);

    function addClGaugeReward(address gauge, address reward) external;

    function removeClGaugeReward(address gauge, address reward) external;

    function designateStale(uint256 _tokenId, bool _status) external;

    function customGaugeForPool(
        address pool
    ) external view returns (address customGauge);

    function designatePartnerNFT(uint256 _tokenId, bool _status) external;

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

    function detachPartner(uint256 _tokenId) external;
}

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

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

    struct LockedBalance {
        int128 amount;
        uint256 end;
    }

    function token() external view returns (address);

    function team() external returns (address);

    function epoch() external view returns (uint256);

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

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

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

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

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

    function transferFrom(address, address, uint256) external;

    function voting(uint256 tokenId) external;

    function abstain(uint256 tokenId) external;

    function attach(uint256 tokenId) external;

    function detach(uint256 tokenId) external;

    function checkpoint() external;

    function deposit_for(uint256 tokenId, uint256 value) external;

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

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

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

    function totalSupply() external view returns (uint256);

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

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

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

    function locked(uint256) external view returns (LockedBalance memory);

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

File 27 of 37 : IXRam.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;

interface IXRam {
    event Approval(
        address indexed owner,
        address indexed spender,
        uint256 value
    );
    event CancelVesting(
        address indexed user,
        uint256 indexed vestId,
        uint256 amount
    );
    event ExitVesting(
        address indexed user,
        uint256 indexed vestId,
        uint256 amount
    );
    event Initialized(uint8 version);
    event InstantExit(address indexed user, uint256);
    event NewExitRatios(uint256 exitRatio, uint256 veExitRatio);
    event NewVest(
        address indexed user,
        uint256 indexed vestId,
        uint256 indexed amount
    );
    event NewVestingTimes(uint256 min, uint256 max, uint256 veMaxVest);
    event RamConverted(address indexed user, uint256);
    event Transfer(address indexed from, address indexed to, uint256 value);
    event WhitelistStatus(address indexed candidate, bool status);
    event XRamRedeemed(address indexed user, uint256);

    function MAXTIME() external view returns (uint256);

    function PRECISION() external view returns (uint256);

    function addWhitelist(address _whitelistee) external;

    function adjustWhitelist(
        address[] memory _candidates,
        bool[] memory _status
    ) external;

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

    function alterExitRatios(
        uint256 _newExitRatio,
        uint256 _newVeExitRatio
    ) external;

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

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

    function changeMaximumVestingLength(uint256 _maxVest) external;

    function changeMinimumVestingLength(uint256 _minVest) external;

    function changeVeMaximumVestingLength(uint256 _veMax) external;

    function changeWhitelistOperator(address _newOperator) external;

    function convertRam(uint256 _amount) external;

    function createVest(uint256 _amount) external;

    function decimals() external view returns (uint8);

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

    function enneadWhitelist() external view returns (address);

    function exitRatio() external view returns (uint256);

    function exitVest(uint256 _vestID, bool _ve) external returns (bool);

    function getBalanceResiding() external view returns (uint256);

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

    function initialize(
        address _timelock,
        address _multisig,
        address _whitelistOperator,
        address _enneadWhitelist
    ) external;

    function instantExit(uint256 _amount) external;

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

    function maxVest() external view returns (uint256);

    function migrateEnneadWhitelist(address _enneadWhitelist) external;

    function migrateMultisig(address _multisig) external;

    function migrateTimelock(address _timelock) external;

    function minVest() external view returns (uint256);

    function multisig() external view returns (address);

    function multisigRedeem(uint256 _amount) external;

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

    function ram() external view returns (address);

    function reinitializeVestingParameters(
        uint256 _min,
        uint256 _max,
        uint256 _veMax
    ) external;

    function removeWhitelist(address _whitelistee) external;

    function rescueTrappedTokens(
        address[] memory _tokens,
        uint256[] memory _amounts
    ) external;

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

    function syncAndCheckIsWhitelisted(
        address _address
    ) external returns (bool);

    function timelock() external view returns (address);

    function totalSupply() external view returns (uint256);

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

    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) external returns (bool);

    function usersTotalVests(address _user) external view returns (uint256);

    function veExitRatio() external view returns (uint256);

    function veMaxVest() external view returns (uint256);

    function veRam() external view returns (address);

    function vestInfo(
        address user,
        uint256
    )
        external
        view
        returns (uint256 amount, uint256 start, uint256 maxEnd, uint256 vestID);

    function voter() external view returns (address);

    function whitelistOperator() external view returns (address);

    function xRamConvertToNft(
        uint256 _amount
    ) external returns (uint256 veRamTokenId);

    function xRamIncreaseNft(uint256 _amount, uint256 _tokenID) external;

    function setPool(address newPool) external;

    function useLegacyPair(bool legacy) external;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    /// @notice Emitted when a new reward token was pushed to the rewards array
    event RewardAdded(address reward);

    /// @notice Emitted when a reward token was removed from the rewards array
    event RewardRemoved(address reward);

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

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

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

    /// @notice Retrieves the total boosted seconds for a specific period.
    /// @param period The period for which to retrieve the total boosted seconds.
    /// @return The total boosted seconds for the specified period.
    function periodTotalBoostedSeconds(
        uint256 period
    ) external view returns (uint256);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    function addRewards(address reward) external;

    function removeRewards(address reward) external;

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

    /// @notice Notifies rewards for periods greater than current period
    /// @dev does not push fees
    /// @dev requires reward token to be whitelisted
    function notifyRewardAmountForPeriod(
        address token,
        uint256 amount,
        uint256 period
    ) external;

    /// @notice Notifies rewards for the next period
    /// @dev does not push fees
    /// @dev requires reward token to be whitelisted
    function notifyRewardAmountNextPeriod(
        address token,
        uint256 amount
    ) external;
}

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

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

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

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

    /// @notice The address of the veRam NFTs
    function veRam() external view returns (address);

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

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

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

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

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

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

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

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

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

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

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

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

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

    /// @notice Emitted when a gauge is created
    /// @param pool The address of the pool
    /// @param pool The address of the created gauge
    event GaugeCreated(address indexed pool, address gauge);

    /// @notice Emitted when pairs implementation is changed
    /// @param oldImplementation The previous implementation
    /// @param newImplementation The new implementation
    event ImplementationChanged(
        address indexed oldImplementation,
        address indexed newImplementation
    );

    /// @notice Emitted when the fee collector is changed
    /// @param oldFeeCollector The previous implementation
    /// @param newFeeCollector The new implementation
    event FeeCollectorChanged(
        address indexed oldFeeCollector,
        address indexed newFeeCollector
    );

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

    /// @notice Returns the RamsesV2 NFP Manager
    function nfpManager() external view returns (address);

    /// @notice Returns the Ramses Voting Sscrow (veRam)
    function veRam() external view returns (address);

    /// @notice Returns Ramses Voter
    function voter() external view returns (address);

    /// @notice Returns the gauge address for a given pool, or address 0 if it does not exist
    /// @param pool The pool address
    /// @return gauge The gauge address
    function getGauge(address pool) external view returns (address gauge);

    /// @notice Returns the address of the fee collector contract
    /// @dev Fee collector decides where the protocol fees go (fee distributor, treasury, etc.)
    function feeCollector() external view returns (address);

    /// @notice Creates a gauge for the given pool
    /// @param pool One of the desired gauge
    /// @return gauge The address of the newly created gauge
    function createGauge(address pool) external returns (address gauge);

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

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

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

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

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

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

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

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

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

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

    /// @notice Emitted when pairs implementation is changed
    /// @param oldImplementation The previous implementation
    /// @param newImplementation The new implementation
    event ImplementationChanged(
        address indexed oldImplementation,
        address indexed newImplementation
    );

    /// @notice Emitted when the fee collector is changed
    /// @param oldFeeCollector The previous implementation
    /// @param newFeeCollector The new implementation
    event FeeCollectorChanged(
        address indexed oldFeeCollector,
        address indexed newFeeCollector
    );

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

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

    /// @notice Emitted when the feeSetter of the factory is changed
    /// @param oldSetter The feeSetter before the setter was changed
    /// @param newSetter The feeSetter after the setter was changed
    event FeeSetterChanged(
        address indexed oldSetter,
        address indexed newSetter
    );

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

    /// @notice Returns the RamsesV2 NFP Manager
    function nfpManager() external view returns (address);

    /// @notice Returns the Ramses Voting Sscrow (veRam)
    function veRam() external view returns (address);

    /// @notice Returns Ramses Voter
    function voter() external view returns (address);

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

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

    /// @notice Returns the address of the fee collector contract
    /// @dev Fee collector decides where the protocol fees go (fee distributor, treasury, etc.)
    function feeCollector() external view returns (address);

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

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

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

    /// @notice returns the default protocol fee.
    function feeProtocol() external view returns (uint8);

    /// @notice returns the protocol fee for both tokens of a pool.
    function poolFeeProtocol(address pool) external view returns (uint8);

    /// @notice Sets the default protocol's % share of the fees
    /// @param feeProtocol new default protocol fee for token0 and token1
    function setFeeProtocol(uint8 feeProtocol) external;

    /// @notice Sets the default protocol's % share of the fees
    /// @param pool the pool address
    /// @param feeProtocol0 new protocol fee for token0 of the pool
    /// @param feeProtocol1 new protocol fee for token1 of the pool
    function setPoolFeeProtocol(
        address pool,
        uint8 feeProtocol0,
        uint8 feeProtocol1
    ) external;

    /// @notice Sets the fee collector address
    /// @param _feeCollector the fee collector address
    function setFeeCollector(address _feeCollector) external;

    function setFee(address _pool, uint24 _fee) external;
}

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

/// @title Permissioned pool actions
/// @notice Contains pool methods that may only be called by the factory owner
interface IRamsesV2PoolOwnerActions {
    /// @notice Set the protocol's % share of the fees
    /// @dev Fees start at 50%, with 5% increments
    function setFeeProtocol() external;

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

    function setFee(uint24 _fee) external;
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"weight","type":"uint256"}],"name":"Abstained","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"gauge","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Attach","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"gauge","type":"address"},{"indexed":false,"internalType":"address","name":"creator","type":"address"},{"indexed":false,"internalType":"address","name":"feeDistributor","type":"address"},{"indexed":true,"internalType":"address","name":"pool","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"}],"name":"CustomGaugeCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"lp","type":"address"},{"indexed":true,"internalType":"address","name":"gauge","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"gauge","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Detach","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"gauge","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"DistributeReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"forbidder","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"bool","name":"status","type":"bool"}],"name":"Forbidden","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"gauge","type":"address"},{"indexed":false,"internalType":"address","name":"creator","type":"address"},{"indexed":false,"internalType":"address","name":"feeDistributor","type":"address"},{"indexed":true,"internalType":"address","name":"pool","type":"address"}],"name":"GaugeCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"gauge","type":"address"}],"name":"GaugeKilled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"gauge","type":"address"}],"name":"GaugeRevived","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"reward","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"NotifyReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"voter","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"weight","type":"uint256"}],"name":"Voted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"whitelister","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"}],"name":"Whitelisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"lp","type":"address"},{"indexed":true,"internalType":"address","name":"gauge","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"gauge","type":"address"},{"indexed":false,"internalType":"uint256","name":"oldRatio","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newRatio","type":"uint256"}],"name":"XRamRatio","type":"event"},{"inputs":[],"name":"BASIS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_ve","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"gauge","type":"address"},{"internalType":"address","name":"reward","type":"address"}],"name":"addClGaugeReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"partners","type":"uint256[]"}],"name":"attachPartners","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"account","type":"address"}],"name":"attachTokenToGauge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"base","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"clFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"clGaugeFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_bribes","type":"address[]"},{"internalType":"address[][]","name":"_tokens","type":"address[][]"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"claimBribes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_gauges","type":"address[]"},{"internalType":"address[][]","name":"_tokens","type":"address[][]"},{"internalType":"uint256[][]","name":"_nfpTokenIds","type":"uint256[][]"}],"name":"claimClGaugeRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_fees","type":"address[]"},{"internalType":"address[][]","name":"_tokens","type":"address[][]"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"claimFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_gauges","type":"address[]"},{"internalType":"address[][]","name":"_tokens","type":"address[][]"}],"name":"claimRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"claimable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_gauges","type":"address[]"}],"name":"clawBackUnusedEmissions","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"}],"name":"createCLGauge","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_pool","type":"address"},{"internalType":"address[]","name":"whitelistedRewards","type":"address[]"}],"name":"createCustomGauge","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_pool","type":"address"}],"name":"createGauge","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"customGaugeFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pool","type":"address"}],"name":"customGaugeForPool","outputs":[{"internalType":"address","name":"customGauge","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"bool","name":"_status","type":"bool"}],"name":"designatePartnerNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"bool","name":"_status","type":"bool"}],"name":"designateStale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"detachPartner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"account","type":"address"}],"name":"detachTokenFromGauge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"}],"name":"distribute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"distributeAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_gauges","type":"address[]"}],"name":"distributeByGauge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"finish","type":"uint256"}],"name":"distributeByRange","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_gauges","type":"address[]"}],"name":"distributeFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"emergencyCouncil","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"emitDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"emitWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"gauge","type":"address"}],"name":"feeDistributers","outputs":[{"internalType":"address","name":"feeDistributor","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeDistributorFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"bool","name":"_status","type":"bool"}],"name":"forbid","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"gauge","type":"address"}],"name":"gaugeXRamRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gaugefactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pool","type":"address"}],"name":"gauges","outputs":[{"internalType":"address","name":"gauge","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"internalType":"uint256","name":"toTokenId","type":"uint256"}],"name":"getVotes","outputs":[{"internalType":"address[][]","name":"tokensVotes","type":"address[][]"},{"internalType":"uint256[][]","name":"tokensWeights","type":"uint256[][]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"governor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"__ve","type":"address"},{"internalType":"address","name":"_factory","type":"address"},{"internalType":"address","name":"_gauges","type":"address"},{"internalType":"address","name":"_feeDistributorFactory","type":"address"},{"internalType":"address","name":"_minter","type":"address"},{"internalType":"address","name":"_msig","type":"address"},{"internalType":"address[]","name":"_tokens","type":"address[]"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_clFactory","type":"address"},{"internalType":"address","name":"_clGaugeFactory","type":"address"},{"internalType":"address","name":"_nfpManager","type":"address"}],"name":"initializeCl","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_factory","type":"address"}],"name":"initializeCustomGaugeFactory","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_xRam","type":"address"}],"name":"initializeXRam","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"initializedVersion","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"gauge","type":"address"}],"name":"isAlive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isForbidden","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"gauge","type":"address"}],"name":"isGauge","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"isWhitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"}],"name":"killGauge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"lastVoted","outputs":[{"internalType":"uint256","name":"time","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"length","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nfpManager","outputs":[{"internalType":"address","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":"tokenId","type":"uint256"}],"name":"partnerNFT","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"poke","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"gauge","type":"address"}],"name":"poolForGauge","outputs":[{"internalType":"address","name":"pool","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolVote","outputs":[{"internalType":"address","name":"pools","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"pools","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"gauge","type":"address"},{"internalType":"address","name":"reward","type":"address"}],"name":"removeClGaugeReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_gauges","type":"address[]"},{"internalType":"address[]","name":"_rewards","type":"address[]"}],"name":"removeGaugeRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"reset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_gauges","type":"address[]"}],"name":"resetGaugeXRamRatio","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"resetVotes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"}],"name":"reviveGauge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_council","type":"address"}],"name":"setEmergencyCouncil","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_gauges","type":"address[]"},{"internalType":"uint256[]","name":"_xRamRatios","type":"uint256[]"}],"name":"setGaugeXRamRatio","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_governor","type":"address"}],"name":"setGovernor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_whitelistOperator","type":"address"}],"name":"setWhitelistOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_xRamRatio","type":"uint256"}],"name":"setXRamRatio","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"stale","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_gauges","type":"address[]"}],"name":"syncLegacyGaugeRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalWeight","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"updateAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_gauges","type":"address[]"}],"name":"updateFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"}],"name":"updateForRange","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"}],"name":"updateGauge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"usedWeights","outputs":[{"internalType":"uint256","name":"totalWeight","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address[]","name":"_poolVote","type":"address[]"},{"internalType":"uint256[]","name":"_weights","type":"uint256[]"}],"name":"vote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"pool","type":"address"}],"name":"votes","outputs":[{"internalType":"uint256","name":"weight","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pool","type":"address"}],"name":"weights","outputs":[{"internalType":"uint256","name":"weight","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"whitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_gauges","type":"address[]"},{"internalType":"address[]","name":"_rewards","type":"address[]"}],"name":"whitelistGaugeRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"whitelistOperator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"xRam","outputs":[{"internalType":"contract IXRam","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"xRamAddress","outputs":[{"internalType":"address","name":"_xRamAddress","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"xRamRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

60808060405234620000c4575f549060ff8260081c1662000072575060ff8082160362000037575b6040516154859081620000c98239f35b60ff90811916175f557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160ff8152a15f62000027565b62461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b6064820152608490fd5b5f80fdfe6080806040526004361015610012575f80fd5b5f3560e01c908162bf3d7c14614143575080630675f276146140b357806306d6a1b21461407a578063075461721461405457806308828eb7146140355780630c340a241461400f5780631123363414613f8f5780631703e5f914613fd25780631f7b6d3214613fb55780631fa2d73c14613f8f57806320b1cb6f14613eb45780632920ae2514613dff5780632fe3c1e514613de2578063310bd74b14613c8f57806332145f9014613bc3578063328285c414613a345780633af32abf146139f75780633c6b16ab146138d65780633e952971146134e6578063402914f5146134ae578063411b1f77146133bc57806342a82b4f1461314a578063436596c4146130e057806344c43782146130ba57806347317bad1461301257806349c06a2214612f5d5780634f2bd32914612f245780635001f3b514612efe57806350d976fc14612e7b578063528cfa9814612e5f57806353d7869314612e2c57806360e64bc614612d30578063618fee6c14612c8b57806363453ae114612c53578063666256aa14612ab557806368c3acb314612c2d578063698473e314612ad65780636ecbe38a14612aba5780637715ee7514612ab55780637778960e14612a8f5780637868f5eb14612a5657806379e9382414612a2c5780637ac09bf7146128765780637bdd4465146128505780637bebe3811461282a5780637cf892f6146127b75780637ee8a2c314612752578063831763a61461264b5780638dd598fb1461262357806391f36633146123155780639647d141146122ef57806396c82e57146122d257806398bbc3c7146122ac578063992a7933146121505780639b19251a146121025780639b6a9d72146120af5780639e37878c146120725780639f06247b14611f13578063a0b1e80414611e41578063a3bb099014611d23578063a4b5820614611b6c578063a5f4301e146115b1578063a61c713a1461153c578063a69a543114611511578063a7cac846146114d9578063a86a366d146114a1578063aa79979b14611464578063ac4afa3814611423578063b65f5126146113f4578063b9a09fd5146113bb578063bba2e5b5146111d0578063c42cf5351461118d578063c45a015514611167578063c527ee1f1461106a578063ce9a4e9e14610ff4578063d23254b414610faf578063d560b0d714610f4e578063da77122d14610dba578063dce1de431461098b578063de7d72e5146108d7578063deeb07c11461084f578063e586875f1461080c578063e74f6166146107e6578063ea94ee4414610783578063eab37eec146104ed578063eddaa0e9146104aa578063efd9bf92146104115763f3594be0146103e3575f80fd5b3461040d57602036600319011261040d576004355f526011602052602060405f2054604051908152f35b5f80fd5b3461040d57604036600319011261040d5761042a61416e565b610432614184565b6001600160a01b03809281601d54163314801561049d575b610453906146bc565b1691823b1561040d5760245f928360405195869485936339ced26d60e21b85521660048401525af180156104925761048757005b610490906141c4565b005b6040513d5f823e3d90fd5b506006548216331461044a565b3461040d57602036600319011261040d576104c361416e565b6001600160a01b03908160065416330361040d57166001600160a01b0319601d541617601d555f80f35b3461040d57606036600319011261040d5767ffffffffffffffff60043581811161040d5761051f903690600401614352565b60243583811161040d57610537903690600401614352565b91909360443590811161040d57610552903690600401614352565b90926001600160a01b03601b5416945f925b84841061056d57005b5f5b61057a858389614ddb565b9050811015610778576105988161059287858b614ddb565b906146ee565b6040516331a9108f60e11b8152903560048201526020816024818c5afa8015610492575f90610738575b6001600160a01b03915016331480156106ac575b1561040d576001600160a01b036105f66105f18789876146ee565b6146fe565b16906106078161059288868c614ddb565b359161061487878d614ddb565b823b1561040d57604080516353c2957d60e11b81526004810196909652602486015260448501819052849160648301915f905b8082106106805750505091815f81819503925af191821561049257600192610671575b500161056f565b61067a906141c4565b8a61066a565b919350916020806001926001600160a01b0361069b886141b0565b168152019401920186939291610647565b506106bc8161059287858b614ddb565b60405163020604bf60e21b8152903560048201526020816024818c5afa8015610492575f906106f8575b6001600160a01b0391501633146105d6565b506020813d602011610730575b8161071260209383614224565b8101031261040d5761072b6001600160a01b0391614832565b6106e6565b3d9150610705565b506020813d602011610770575b8161075260209383614224565b8101031261040d5761076b6001600160a01b0391614832565b6105c2565b3d9150610745565b509260010192610564565b3461040d5761079136614545565b919091335f52601260205260ff60405f2054161561040d5760405191825260208201527ff341246adaac6f497bc2a656f546ab9e182111d630394f0c57c710a59a2cb56760406001600160a01b0333941692a3005b3461040d575f36600319011261040d5760206001600160a01b0360195416604051908152f35b3461040d57602036600319011261040d5761082561416e565b600754906001600160a01b03808316330361040d576001600160a01b031991169116176007555f80f35b3461040d57602036600319011261040d576004356108836001600160a01b0380601d541633149081156108c9575b506146bc565b610891612710821115614d61565b5f7fae82f56546faac02afaec59c20cab0ed4cb15bb32ad1be67ed0bcecd49cbde846040601e548151908152846020820152a2601e55005b90506006541633148361087d565b3461040d57604036600319011261040d576108f061416e565b6108f86143ce565b906001600160a01b039081601d54163314801561097e575b610919906146bc565b1690815f52602160205260405f2060ff81541691801515809315150361093b57005b610950919060ff801983541691151516179055565b6040519081527fc226090c79560682a4254f61540d22465b1f23522ee477acb0a520160d3c3e0460203392a3005b5060065482163314610910565b3461040d57606036600319011261040d576109a461416e565b6109ac614184565b60443567ffffffffffffffff811161040d576109cc903690600401614352565b6001600160a01b039384600654163303610d75575f91856004541693604051968791630317318f60e11b8352818516968760048501526020998a91816024998a925af1928315610492575f93610d3f575b505f9293898388541688604051809781936301126ca960e21b83528d60048401525af1938415610492575f94610d08575b505f5b818110610cab575050508060025416916040519763095ea7b360e01b808a52838316998a60048201528b815f1997888c830152815a6044925f91f18015610492578c928c92604492610c8e575b505f87601c5416604051998a958694855260048501528d8401525af1938415610492578996610b468594610b4b938e98610c61575b50895f52600c8852601260405f20986001600160a01b031999888c168b8254161790558d5f52600a815260405f208c8b8254161790558b5f52600b81528d60405f20908b825416179055528d601460405f209160ff199260018482541617905552600160405f2091825416179055615386565b61492a565b169485610ba0575b5050604080513381526001600160a01b0390931660208401527f89db950816d6b0f68e51bad00bf438fa35268fcbe53cc183011d7c9b9baaa2a7929150819081015b0390a4604051908152f35b9091929350845f52600a88528160405f2054165f526014885260ff60405f205416610c1e575085927f89db950816d6b0f68e51bad00bf438fa35268fcbe53cc183011d7c9b9baaa2a792610c04610b9593875f5260258b5260405f20541615614846565b855f52602589528460405f20918254161790559188610b53565b87600c6064926040519262461bcd60e51b845260048401528201527f41637469766520676175676500000000000000000000000000000000000000006044820152fd5b610c8090893d8b11610c87575b610c788183614224565b81019061476b565b508e610ad3565b503d610c6e565b610ca490853d8711610c8757610c788183614224565b508e610a9e565b83851690610cbd6105f18285876146ee565b823b1561040d57858a5f9283604051968794859363db89461b60e01b85521660048401525af191821561049257600192610cf9575b5001610a51565b610d02906141c4565b8c610cf2565b9093508981813d8311610d38575b610d208183614224565b8101031261040d57610d3190614832565b928a610a4e565b503d610d16565b92508883813d8311610d6e575b610d568183614224565b8101031261040d57610d685f93614832565b92610a1d565b503d610d4c565b60405162461bcd60e51b815260206004820152600560248201527f21415554480000000000000000000000000000000000000000000000000000006044820152606490fd5b3461040d5760208060031936011261040d5760043567ffffffffffffffff811161040d57610ded60049136908301614352565b9190926001600160a01b039283601d541633148015610f41575b610e10906146bc565b81846005541660405194858092631a2732c160e31b82525afa928315610492575f93610f12575b5062093a8092838101809111610efe57610e5290421061471f565b5f93834204848102948186041490151715945b828110610e6e57005b85610efe57610e7e8184896146ee565b355f52601184528460405f2055610e9f610e9982858a6146ee565b35614e20565b815f5460101c1690610eb281858a6146ee565b35823b1561040d575f9260248492604051958693849263c1f0fb9f60e01b845260048401525af191821561049257600192610eef575b5001610e65565b610ef8906141c4565b88610ee8565b634e487b7160e01b5f52601160045260245ffd5b9092508181813d8311610f3a575b610f2a8183614224565b8101031261040d57519185610e37565b503d610f20565b5060065484163314610e07565b3461040d57602036600319011261040d5760043567ffffffffffffffff811161040d57610f7f9036906004016142b4565b5f5b81518110156104905780610fa96001600160a01b03610fa26001948661466c565b5116615386565b01610f81565b3461040d57604036600319011261040d57610fc8614184565b6004355f52600e6020526001600160a01b0360405f2091165f52602052602060405f2054604051908152f35b3461040d57602036600319011261040d576001600160a01b0380601d54163314801561105d575b611024906146bc565b5f5460101c16803b1561040d575f8091602460405180948193634c35bec560e11b835260043560048401525af180156104925761048757005b506006548116331461101b565b3461040d5760208060031936011261040d5760043567ffffffffffffffff811161040d5761109c9036906004016142b4565b905f5b8251811015610490576001600160a01b03600483826110be858861466c565b51166040519283809263e574821360e01b82525afa908115610492575f9161114a575b506110f0575b5060010161109f565b60405f916110fe848761466c565b5116600482518094819363d294f09360e01b83525af1801561049257156110e757604090813d8311611143575b6111358183614224565b8101031261040d57836110e7565b503d61112b565b6111619150843d8611610c8757610c788183614224565b856110e1565b3461040d575f36600319011261040d5760206001600160a01b0360015416604051908152f35b3461040d57602036600319011261040d576111a661416e565b600654906001600160a01b03808316330361040d576001600160a01b031991169116176006555f80f35b3461040d5760208060031936011261040d576111ea61416e565b906101035f5460ff8160081c1615806113ae575b611207906145cd565b61ffff1916175f556001600160a01b0391826006541633148015611382575b1561040d57821691826001600160a01b0319601c541617601c555f7fae82f56546faac02afaec59c20cab0ed4cb15bb32ad1be67ed0bcecd49cbde84604061138880601e5581519084825286820152a28060025416906040519163095ea7b360e01b908184528560048501525f199160249483602482015286816044815f82975af1801561049257611365575b50600954935f5b8581106112f6577f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024988861ff00195f54165f5560405160038152a1005b8082611302879361456f565b90549060031b1c165f52600a89528888868c5f876040822054169160405197889586948c865260048601528401525af191821561049257600192611348575b50016112ba565b61135e908a3d8c11610c8757610c788183614224565b508a611341565b61137b90873d8911610c8757610c788183614224565b50876112b3565b50827fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610354163314611226565b50600360ff8216106111fe565b3461040d57602036600319011261040d5760206001600160a01b03806113df61416e565b165f52600a825260405f205416604051908152f35b3461040d57602036600319011261040d576004355f526023602052602060ff60405f2054166040519015158152f35b3461040d57602036600319011261040d5760043560095481101561040d576001600160a01b0361145460209261456f565b9190546040519260031b1c168152f35b3461040d57602036600319011261040d576001600160a01b0361148561416e565b165f526012602052602060ff60405f2054166040519015158152f35b3461040d576114af3661452f565b905f52600f60205260405f2090815481101561040d576114546001600160a01b03916020936145b8565b3461040d57602036600319011261040d576001600160a01b036114fa61416e565b165f52600d602052602060405f2054604051908152f35b3461040d57602036600319011261040d57602061153461152f61416e565b614dad565b604051908152f35b3461040d5761154a36614545565b919091335f52601260205260ff60405f2054161561040d57601460205260ff60405f2054161561040d5760405191825260208201527fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d760406001600160a01b0333941692a3005b3461040d5760208060031936011261040d576115cb61416e565b6001600160a01b03908282821691825f52600a82526115f08460405f20541615614846565b8360015416906040519283809363e5e31b1360e01b825286600483015260249485915afa928315610492575f93611b4d575b508215611b09576060855f945f90611970575b5f95826006541633036118fc575b50508790600454168460405180978193630317318f60e11b83528a60048401525af1938415610492575f946118c0575b50906116c99187876003541691885f5460101c1692895f8a60405198899586948593630f6f2d4760e11b855260048501528d1698898d85015260448401526001606484015260a0608484015260a4830190614680565b03925af1928315610492575f93611889575b508660025416926040519763095ea7b360e01b90818a52808316998a60048201528b815f1998898b830152815a6044925f91f1928315610492575f8c936044938f9661186c575b50601c5416604051998a958694855260048501528b8401525af1918215610492576117be94610b469361184f575b50885f52600c8a5260405f206001600160a01b03199182825416179055875f52600a8a5260405f208982825416179055885f52600b8a528760405f20918254161790556012895260405f2060ff199060018282541617905560148a52600160405f2091825416179055615386565b823b1561040d575f6040518092635b8d276760e11b8252600160048301528183875af180156104925784927f48d3c521fd0d5541640f58c6d6381eed7cb2e8c9df421ae165a4f4c2d221ee0d9261183592611840575b50604080513381526001600160a01b03909216602083015290918291820190565b0390a3604051908152f35b611849906141c4565b87611814565b611865908b3d8d11610c8757610c788183614224565b508a611750565b61188290873d8911610c8757610c788183614224565b508f611722565b9092508781813d83116118b9575b6118a18183614224565b8101031261040d576118b290614832565b91886116db565b503d611897565b919093508682813d83116118f5575b6118d98183614224565b8101031261040d576118ed6116c992614832565b939091611673565b503d6118cf565b821680875260218a5260ff604088205416158061195c575b61191d90614892565b86526013895260ff6040872054169081611945575b5061193d91506148de565b858880611643565b905016845261193d60ff6040862054168791611932565b508183168752604087205460ff1615611914565b505050909150604051634eb1c24560e11b8152604081600481875afa908115610492575f905f92611ac2575b508190808760025416938882169185831492838015611ab7575b15611a465750604051926080840184811067ffffffffffffffff821117611a33578b95935f9a999897959387938f606090611a1f956040526003885236908801378599611a028761463f565b5284601c5416611a118761464c565b528c14611a2b57509261465c565b911690525b9550611635565b90509261465c565b89634e487b7160e01b5f5260416004525ffd5b92505060405191611a56836141ec565b600483526080368c8501378295611a6c8461463f565b5289601c5416611a7b8461464c565b52611a858361465c565b52815160031015611aa45788166080909101525f949392918791611a24565b86634e487b7160e01b5f5260326004525ffd5b50868b8416146119b6565b9150506040813d604011611b01575b81611ade60409383614224565b8101031261040d57611afa86611af383614832565b9201614832565b908761199c565b3d9150611ad1565b60405162461bcd60e51b8152600481018790526006818401527f215f706f6f6c00000000000000000000000000000000000000000000000000006044820152606490fd5b611b65919350863d8811610c8757610c788183614224565b9186611622565b3461040d5760208060031936011261040d5760043567ffffffffffffffff811161040d57611b9e903690600401614352565b90916001600160a01b0380601d541633148015611d16575b611bbf906146bc565b5f82826005541660046040518094819363ed29fc1160e01b83525af1908115610492578391611ced575b50505f5b838110611bf657005b611c0c611c076105f18387896146ee565b615386565b81611c1b6105f18387896146ee565b165f526014835260ff60405f20541615611c38575b600101611bed565b81611c476105f18387896146ee565b165f5260189081845260405f20549183611c656105f184898b6146ee565b165f5284525f60408120558382611c7f575b509050611c30565b60025460065460405163a9059cbb60e01b81529086166001600160a01b03166004820152602481019490945283908516815f816044810103925af191821561049257600192611cd0575b5083611c77565b611ce690853d8711610c8757610c788183614224565b5086611cc9565b813d8311611d0f575b611d008183614224565b8101031261040d578185611be9565b503d611cf6565b5060065481163314611bb6565b3461040d57611d3136614383565b6001600160a01b03939192939283601d541633148015611e34575b611d55906146bc565b818503611def575f5b858110611d6757005b80611d7560019285856146ee565b35611d84612710821115614d61565b7fae82f56546faac02afaec59c20cab0ed4cb15bb32ad1be67ed0bcecd49cbde846040611db56105f1858c8b6146ee565b89611dbf82614dad565b911693845f526020601f815281845f2055808052835f208860ff198254161790558351928352820152a201611d5e565b60405162461bcd60e51b815260206004820152600f60248201527f6c656e677468206d69736d6174636800000000000000000000000000000000006044820152606490fd5b5060065484163314611d4c565b3461040d5760208060031936011261040d5760043567ffffffffffffffff811161040d57611e73903690600401614352565b916001600160a01b039182601d541633148015611f06575b611e94906146bc565b601e54935f5b818110611ea357005b80611eb46105f160019385876146ee565b7fae82f56546faac02afaec59c20cab0ed4cb15bb32ad1be67ed0bcecd49cbde84604088611ee184614dad565b931692835f52888052815f2060ff19815416905581519081528a89820152a201611e9a565b5060065483163314611e8b565b3461040d5760208060031936011261040d57611f2d61416e565b906001600160a01b03809281601d541633148015612065575b611f4f906146bc565b1691825f526014825260ff60405f205416612020575f80918482526014845260408220600160ff19825416179055600b84526040822054169260405190810190636373ea6960e01b825260048152611fa681614208565b5190845afa611fb3614d22565b50611fe0575b507fed18e9faa3dccfd8aa45f69c4de40546b2ca9cccc4538a2323531656516db1aa5f80a2005b803b1561040d575f8091602460405180948193635b8d276760e11b8352600160048401525af180156104925715611fb95761201a906141c4565b81611fb9565b60405162461bcd60e51b815260048101839052601360248201527f676175676520616c726561647920616c697665000000000000000000000000006044820152606490fd5b5060065482163314611f46565b3461040d57602036600319011261040d576001600160a01b0361209361416e565b165f526021602052602060ff60405f2054166040519015158152f35b3461040d576120bd3661452f565b905b8181106120c857005b806120fc6120d760019361456f565b906001600160a01b03918291549060031b1c165f52600a60205260405f205416615386565b016120bf565b3461040d57602036600319011261040d5761049061211e61416e565b61213d6001600160a01b0380601d5416331490811561214257506146bc565b615429565b90506006541633148461087d565b3461040d5760208060031936011261040d5761216a61416e565b906001600160a01b03809281601d54163314801561229f575b61218c906146bc565b1691825f526014825260ff60405f2054161561225a575f8091848252601484526040822060ff198154169055600b84526040822054169260405190810190636373ea6960e01b8252600481526121e181614208565b5190845afa6121ee614d22565b5061221b575b507f04a5d3f5d80d22d9345acc80618f4a4e7e663cf9e1aed23b57d975acec002ba75f80a2005b803b1561040d575f8091602460405180948193635b8d276760e11b83528160048401525af1801561049257156121f457612254906141c4565b816121f4565b60405162461bcd60e51b815260048101839052601260248201527f676175676520616c7265616479206465616400000000000000000000000000006044820152606490fd5b5060065482163314612183565b3461040d575f36600319011261040d5760206001600160a01b03601b5416604051908152f35b3461040d575f36600319011261040d576020600854604051908152f35b3461040d575f36600319011261040d5760206001600160a01b0360045416604051908152f35b3461040d5761232f6123263661452f565b9080929161496d565b90600182018211610efe579061234760018201614246565b906123556040519283614224565b6001810180835261236590614246565b926123786020840194601f190185614d06565b61238460018301614246565b916123926040519384614224565b6001810183526123b46123a760018301614246565b601f190160208501614d06565b5f5b6001820181106124d6575050506040519160408301906040845251809152606083019060608160051b85010194915f905b82821061247757505050508183036020830152805180845260208401906020808260051b8701019301915f905b8282106124215785850386f35b90919293601f19878203018252845190602080835192838152019201905f905b80821061245f57505050602080600192960192019201909291612414565b90919260208060019286518152019401920190612441565b90919295605f19868203018252865190602080835192838152019201905f905b8082106124b5575050506020806001929801920192019092916123e7565b9091926020806001926001600160a01b038751168152019401920190612497565b91946124e58387969396614712565b94855f52600f6020526124fb60405f2054614800565b612505858561466c565b52612510848461466c565b50855f52600f60205260405f20604051808260208294549384815201905f5260205f20925f905b8082106125fe57505061254c92500382614224565b612556858561466c565b52612561848461466c565b50855f52600f60205261257760405f2054614800565b612581858761466c565b5261258c848661466c565b505f5b612599858561466c565b51518110156125ee57600190875f52600e60205260405f206001600160a01b036125cd836125c78a8a61466c565b5161466c565b51165f5260205260405f20546125e7826125c7898b61466c565b520161258f565b50909591945090916001016123b6565b916001919350602082916001600160a01b038754168152019401920184929391612537565b3461040d575f36600319011261040d5760206001600160a01b035f5460101c16604051908152f35b3461040d57602036600319011261040d5760043567ffffffffffffffff811161040d5761267c903690600401614352565b6101055f5460ff8160081c161580612745575b612698906145cd565b61ffff1916175f555f5b8181106126df5761ff00195f54165f557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160058152a1005b6001600160a01b035f5460101c16906126f98184866146ee565b35823b1561040d575f9260248492604051958693849263fbd3a29d60e01b845260048401525af191821561049257600192612736575b50016126a2565b61273f906141c4565b8461272f565b50600560ff82161061268f565b3461040d576127603661452f565b905b81811061276b57005b6127748161456f565b906001600160a01b03918291549060031b1c165f52600a60205260405f20541690600160158181540361040d576127b06001946002835561497a565b5501612762565b3461040d57602036600319011261040d5760043567ffffffffffffffff811161040d576127e89036906004016142b4565b5f5b8151811015610490576001600160a01b03612805828461466c565b511690600160158181540361040d576128236001946002835561497a565b55016127ea565b3461040d575f36600319011261040d5760206001600160a01b03601a5416604051908152f35b3461040d575f36600319011261040d5760206001600160a01b0360245416604051908152f35b3461040d57606036600319011261040d5767ffffffffffffffff60043560243582811161040d576128ab903690600401614352565b909260443590811161040d576128c5903690600401614352565b9290916001600160a01b0394856005541691604051968793631a2732c160e31b855284600460209a8b935afa938415610492575f946129fd575b5062093a8093848101809111610efe5761291a90421061471f565b5f5460405163430c208160e01b8152336004820152602481018790529189918391604491839160109190911c165afa801561049257612960915f916129e0575b50614783565b85810361040d57824204838102938185041490151715610efe5761299192845f526011885260405f2055369161425e565b9161299b84614246565b936129a96040519586614224565b8085528585019060051b82019136831161040d57905b8282106129d15761049086868661501b565b813581529086019086016129bf565b6129f79150893d8b11610c8757610c788183614224565b8961295a565b9093508781813d8311612a25575b612a158183614224565b8101031261040d575192886128ff565b503d612a0b565b3461040d57602036600319011261040d576004355f526010602052602060405f2054604051908152f35b3461040d57602036600319011261040d5760206001600160a01b0380612a7a61416e565b165f526025825260405f205416604051908152f35b3461040d575f36600319011261040d5760206001600160a01b0360075416604051908152f35b6143dd565b3461040d57602036600319011261040d57610490611c0761416e565b3461040d57604036600319011261040d57600435612af2614184565b90335f5260206012815260ff60405f2054168015612c07575b1561040d57335f526014815260ff60405f2054168015612be1575b1561040d5781612b68575b7f60940192810a6fb3bce3fd3e2e3a13fd6ccc7605e963fb87ee971aba829989bd906040519283526001600160a01b0333941692a3005b6001600160a01b035f5460101c1690813b1561040d575f809260246040518095819363fbd3a29d60e01b83528860048401525af1918215610492577f60940192810a6fb3bce3fd3e2e3a13fd6ccc7605e963fb87ee971aba829989bd92612bd2575b509050612b31565b612bdb906141c4565b84612bca565b50600a81526001600160a01b0360405f2054165f526012815260ff60405f205416612b26565b50600a81526001600160a01b0360405f2054165f526012815260ff60405f205416612b0b565b3461040d575f36600319011261040d5760206001600160a01b0360035416604051908152f35b3461040d57602036600319011261040d57612c6c61416e565b60016015540361040d57612c8490600260155561497a565b6001601555005b3461040d57602036600319011261040d5760043567ffffffffffffffff811161040d57612cbc903690600401614352565b6001600160a01b0380601c5416925f5b838110612cd557005b82612ce46105f18387866146ee565b1690813b1561040d575f8092602460405180958193633cc7227f60e11b83528b60048401525af191821561049257600192612d21575b5001612ccc565b612d2a906141c4565b86612d1a565b3461040d57606036600319011261040d57612d4961416e565b612d51614184565b90612d5a61419a565b905f549160ff8360081c161580612e1f575b612d75906145cd565b6001600160a01b0390816006541633148015612df3575b1561040d5781600295816001600160a01b031995168560195416176019551683601a541617601a551690601b541617601b5561ffff1916175f557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160028152a1005b50817fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610354163314612d8c565b50600260ff841610612d6c565b3461040d575f36600319011261040d576009545f5b818110612e4a57005b80612e596120d760019361456f565b01612e41565b3461040d575f36600319011261040d5760206040516127108152f35b3461040d57604036600319011261040d57612e9461416e565b612e9c614184565b6001600160a01b03809281601d541633148015612ef1575b612ebd906146bc565b1691823b1561040d5760245f92836040519586948593639dfb338160e01b85521660048401525af180156104925761048757005b5060065482163314612eb4565b3461040d575f36600319011261040d5760206001600160a01b0360025416604051908152f35b3461040d57602036600319011261040d5760206001600160a01b0380612f4861416e565b165f52600c825260405f205416604051908152f35b3461040d57612f6b36614383565b6001600160a01b03939291939182601d541633148015613005575b612f8f906146bc565b5f5b818110612f9a57005b83612fa96105f18385896146ee565b1690612fb96105f182868a6146ee565b823b1561040d578560245f92836040519687948593630c96238f60e01b85521660048401525af191821561049257600192612ff6575b5001612f91565b612fff906141c4565b87612fef565b5060065483163314612f86565b3461040d57604036600319011261040d5760043561302e6143ce565b9061304e6001600160a01b0380601d5416331490811561214257506146bc565b805f526022602052600160ff60405f2054161515036130905761308b61049092825f52602360205260405f209060ff801983541691151516179055565b614e20565b60405162461bcd60e51b8152602060048201526002602482015261021560f41b6044820152606490fd5b3461040d575f36600319011261040d5760206001600160a01b03601d5416604051908152f35b3461040d575f36600319011261040d576009545f5b8181106130fe57005b6131078161456f565b906001600160a01b03918291549060031b1c165f52600a60205260405f20541690600160158181540361040d576131436001946002835561497a565b55016130f5565b3461040d5760e036600319011261040d5761316361416e565b61316b614184565b9061317461419a565b91606435906001600160a01b039182811680910361040d576084359183831680930361040d5760a4359084821680920361040d5760c4359367ffffffffffffffff851161040d576131ca869536906004016142b4565b935f5498602060ff8b60081c1615998a809b6133af575b801561338b575b6131f1906145cd565b60019b8b8d60ff198316175f5561337a575b505f547fffffffffffffffffffff0000000000000000000000000000000000000000ffff75ffffffffffffffffffffffffffffffffffffffff00008360101b169116175f55886001600160a01b03199616868d5416178c556004604051809b8193637e062a3560e11b8352165afa8015610492578a985f91613338575b50908780921685600254161760025516836003541617600355826004541617600455816005541617600555818160065416176006556007541617600755825f905b61330c575b505050601555816016556132d657005b60207f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989161ff00195f54165f55604051908152a1005b8151811015613333578061332c8461332587948661466c565b5116615429565b01836132c1565b6132c6565b919850506020813d602011613372575b8161335560209383614224565b8101031261040d5789978761336a8193614832565b919250613280565b3d9150613348565b61ffff1916610101175f558c613203565b506131f1303b158d816133a1575b5090506131e8565b6001915060ff16148d613399565b50600160ff8d16106131e1565b3461040d57604036600319011261040d576004356133d8614184565b90335f52601260205260ff60405f2054168015613486575b1561040d5780613433575b6040519081527fae268d9aab12f3605f58efd74fd3801fa812b03fdb44317eb70f46dff0e19e2260206001600160a01b0333941692a3005b6001600160a01b035f5460101c16803b1561040d575f8091602460405180948193634c35bec560e11b83528760048401525af1801561049257613477575b506133fb565b613480906141c4565b82613471565b50600a6020526001600160a01b0360405f2054165f52601260205260ff60405f2054166133f0565b3461040d57602036600319011261040d576001600160a01b036134cf61416e565b165f526018602052602060405f2054604051908152f35b3461040d57606036600319011261040d576134ff61416e565b613507614184565b60443562ffffff811680910361040d576001600160a01b038092816019541694604051948591630b4c774160e11b835216958660048301528360249316948584840152604483015281606460209788935afa908115610492575f916138a1575b5082811693841561385d575f9596858752600a885261358c8560408920541615614846565b846006541633036137f4575b50508583600454168360405180988193630317318f60e11b83528960048401525af1928315610492575f936137be575b5f95508681601a541684604051809981936352fa180f60e11b83528a60048401525af1958615610492575f96613787575b508060025416956040519663095ea7b360e01b90818952838316988960048201528a816044815f801996878d8401525af1928315610492575f8b936044938e9661376a575b5087601c5416906040519a8b968795865260048601528401525af1918215610492576136dd94610b469361374d575b50875f52600c895260405f206001600160a01b031991871682825416179055865f52600a895260405f208882825416179055875f52600b89528660405f20918254161790556012885260405f2060ff199060018282541617905560148952600160405f2091825416179055615386565b813b1561040d57604051637b7d549d60e01b81525f8160048183875af180156104925784927f48d3c521fd0d5541640f58c6d6381eed7cb2e8c9df421ae165a4f4c2d221ee0d92611835926118405750604080513381526001600160a01b03909216602083015290918291820190565b613763908a3d8c11610c8757610c788183614224565b508961366d565b61378090873d8911610c8757610c788183614224565b508e61363e565b9095508681813d83116137b7575b61379f8183614224565b8101031261040d576137b090614832565b94876135f9565b503d613795565b92508585813d83116137ed575b6137d58183614224565b8101031261040d576137e75f95614832565b926135c8565b503d6137cb565b8087526021885260ff604088205416158061384b575b61381390614892565b86526013875260ff60408720541680613838575b61383191506148de565b8680613598565b50855261383160ff604087205416613827565b50818752604087205460ff161561380a565b60405162461bcd60e51b8152600481018790526007818501527f6e6f20706f6f6c000000000000000000000000000000000000000000000000006044820152606490fd5b90508481813d83116138cf575b6138b88183614224565b8101031261040d576138c990614832565b86613567565b503d6138ae565b3461040d57602036600319011261040d576004356008546138f357005b6001600160a01b038060025416803b1561040d575f80916040518260208201916323b872dd60e01b83523360248201523060448201528760648201526064815261393c816141ec565b51925af1613948614d22565b816139c8575b501561040d57670de0b6b3a7640000808302908382041483151715610efe57600854613979916147cf565b806139b3575b5060025416906040519081527ff70d5c697de7ea828df48e5c4573cb2194c659f1901f70110c52b066dcf5082660203392a3005b6139bf90601654614712565b6016558261397f565b80518015925082156139dd575b50508361394e565b6139f0925060208091830101910161476b565b83806139d5565b3461040d57602036600319011261040d576001600160a01b03613a1861416e565b165f526013602052602060ff60405f2054166040519015158152f35b3461040d57604036600319011261040d57600435613a506143ce565b6001600160a01b0380601d541633148015613bb6575b613a6f906146bc565b81158080613ba0575b613b87575b8280613b70575b15613af357505f5460101c1691823b1561040d575f809360246040518096819363fbd3a29d60e01b83528660048401525af19283156104925761049093613ae4575b505b5f52602260205260405f209060ff801983541691151516179055565b613aed906141c4565b83613ac6565b80613b5a575b613b08575b5061049091613ac8565b5f5460101c1691823b1561040d575f8093602460405180968193634c35bec560e11b83528660048401525af19283156104925761049093613b4b575b5091613afe565b613b54906141c4565b83613b44565b50825f52602260205260ff60405f205416613af9565b50835f52602260205260ff60405f20541615613a84565b835f52602360205260405f2060ff198154169055613a7d565b50835f52602360205260ff60405f205416613a78565b5060065481163314613a66565b3461040d5760208060031936011261040d5760043590815f52600f815260405f206040518082848294549384815201905f52845f20925f5b86828210613c7057505050613c1292500382614224565b805192613c1e84614800565b925f5b858110613c34575050610490935061501b565b600190835f52600e835260405f206001600160a01b03613c54838861466c565b51165f52835260405f2054613c69828861466c565b5201613c21565b85546001600160a01b0316845260019586019587955093019201613bfb565b3461040d5760208060031936011261040d576004359060046001600160a01b039180836005541660405193848092631a2732c160e31b82525afa918215610492575f92613db3575b5062093a8091828101809111610efe57613cf290421061471f565b5f5460405163430c208160e01b8152336004820152602481018690529082908290604490829060101c88165afa801561049257613d35915f91613d965750614783565b814204828102928184041490151715610efe57601190845f525260405f2055613d5d82614e20565b5f5460101c1690813b1561040d575f9160248392604051948593849263c1f0fb9f60e01b845260048401525af180156104925761048757005b613dad9150833d8511610c8757610c788183614224565b8661295a565b9080925081813d8311613ddb575b613dcb8183614224565b8101031261040d57519084613cd7565b503d613dc1565b3461040d575f36600319011261040d576020601e54604051908152f35b3461040d57613e0d36614383565b6001600160a01b03939291939182601d541633148015613ea7575b613e31906146bc565b5f5b818110613e3c57005b83613e4b6105f18385896146ee565b1690613e5b6105f182868a6146ee565b823b1561040d578560245f92836040519687948593633cc7227f60e11b85521660048401525af191821561049257600192613e98575b5001613e33565b613ea1906141c4565b87613e91565b5060065483163314613e28565b3461040d57604036600319011261040d5767ffffffffffffffff60043581811161040d57613ee69036906004016142b4565b60249160243590811161040d57613f019036906004016142d2565b915f5b8251811015610490576001600160a01b03613f1f828561466c565b511690613f2c818661466c565b5191803b1561040d57613f665f939184926040519586809481936331279d3d60e01b835233600484015260408b8401526044830190614680565b03925af191821561049257600192613f80575b5001613f04565b613f89906141c4565b85613f79565b3461040d575f36600319011261040d5760206001600160a01b03601c5416604051908152f35b3461040d575f36600319011261040d576020600954604051908152f35b3461040d57602036600319011261040d576001600160a01b03613ff361416e565b165f526014602052602060ff60405f2054166040519015158152f35b3461040d575f36600319011261040d5760206001600160a01b0360065416604051908152f35b3461040d575f36600319011261040d57602060ff5f5416604051908152f35b3461040d575f36600319011261040d5760206001600160a01b0360055416604051908152f35b3461040d57602036600319011261040d5760206001600160a01b038061409e61416e565b165f52600b825260405f205416604051908152f35b3461040d57602036600319011261040d5760046140ce61416e565b6001600160a01b035f549160ff8360081c161580614137575b6140f0906145cd565b166001600160a01b0319602454161760245561ffff1916175f557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160048152a1005b5060ff831684116140e7565b3461040d57602036600319011261040d576020906004355f526022825260ff60405f20541615158152f35b600435906001600160a01b038216820361040d57565b602435906001600160a01b038216820361040d57565b604435906001600160a01b038216820361040d57565b35906001600160a01b038216820361040d57565b67ffffffffffffffff81116141d857604052565b634e487b7160e01b5f52604160045260245ffd5b60a0810190811067ffffffffffffffff8211176141d857604052565b6040810190811067ffffffffffffffff8211176141d857604052565b90601f8019910116810190811067ffffffffffffffff8211176141d857604052565b67ffffffffffffffff81116141d85760051b60200190565b929161426982614246565b916142776040519384614224565b829481845260208094019160051b810192831161040d57905b82821061429d5750505050565b8380916142a9846141b0565b815201910190614290565b9080601f8301121561040d578160206142cf9335910161425e565b90565b81601f8201121561040d578035916020916142ec84614246565b936142fa6040519586614224565b808552838086019160051b8301019280841161040d57848301915b8483106143255750505050505090565b823567ffffffffffffffff811161040d578691614347848480948901016142b4565b815201920191614315565b9181601f8401121561040d5782359167ffffffffffffffff831161040d576020808501948460051b01011161040d57565b604060031982011261040d5767ffffffffffffffff9160043583811161040d57826143b091600401614352565b9390939260243591821161040d576143ca91600401614352565b9091565b60243590811515820361040d57565b3461040d57606036600319011261040d5767ffffffffffffffff6004803582811161040d576144109036906004016142b4565b9060249260243590811161040d5761442c9036906004016142d2565b5f546040805163430c208160e01b815233600482015260448035602483018190529297909490939092916001600160a01b039160209082908890829060101c86165afa908115610492575f91614510575b501561040d575f5b87518110156104905781614499828a61466c565b5116906144a6818661466c565b5191803b1561040d57865f9186838c8f976144dd908e8a519a8b98899788966353c2957d60e11b8852870152850152830190614680565b03925af1918215614506576001926144f7575b5001614485565b614500906141c4565b5f6144f0565b8a513d5f823e3d90fd5b614529915060203d602011610c8757610c788183614224565b5f61447d565b604090600319011261040d576004359060243590565b606090600319011261040d57600435906024356001600160a01b038116810361040d579060443590565b6009548110156145a45760095f527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af01905f90565b634e487b7160e01b5f52603260045260245ffd5b80548210156145a4575f5260205f2001905f90565b156145d457565b60405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608490fd5b8051156145a45760200190565b8051600110156145a45760400190565b8051600210156145a45760600190565b80518210156145a45760209160051b010190565b9081518082526020808093019301915f5b82811061469f575050505090565b83516001600160a01b031685529381019392810192600101614691565b156146c357565b606460405162461bcd60e51b81526020600482015260046024820152630c2eae8d60e31b6044820152fd5b91908110156145a45760051b0190565b356001600160a01b038116810361040d5790565b91908201809211610efe57565b1561472657565b60405162461bcd60e51b815260206004820152600d60248201527f5550444154455f504552494f44000000000000000000000000000000000000006044820152606490fd5b9081602091031261040d5751801515810361040d5790565b1561478a57565b60405162461bcd60e51b815260206004820152600960248201527f21617070726f76656400000000000000000000000000000000000000000000006044820152606490fd5b81156147d9570490565b634e487b7160e01b5f52601260045260245ffd5b81810292918115918404141715610efe57565b9061480a82614246565b6148176040519182614224565b8281528092614828601f1991614246565b0190602036910137565b51906001600160a01b038216820361040d57565b1561484d57565b60405162461bcd60e51b815260206004820152600660248201527f65786973747300000000000000000000000000000000000000000000000000006044820152606490fd5b1561489957565b60405162461bcd60e51b815260206004820152600960248201527f466f7262696464656e00000000000000000000000000000000000000000000006044820152606490fd5b156148e557565b60405162461bcd60e51b815260206004820152600c60248201527f2177686974656c697374656400000000000000000000000000000000000000006044820152606490fd5b600954680100000000000000008110156141d85780600161494e920160095561456f565b6001600160a01b039291928084549260031b9316831b921b1916179055565b91908203918211610efe57565b6005545f906001600160a01b03806040938451809463ed29fc1160e01b82526020958691815f6004988993165af18015614cfc57908591614cd3575b50506149c186615386565b81861695865f526014855260ff865f2054166149e1575b50505050505050565b60188552855f2054938415614cc957614a15612710614a0d614a0787601c541695614dad565b886147ed565b04809661496d565b9360019085151580614c42575b8715159283614bbf575b614a3a575b505050506149d8565b8a5f52601889525f8a812055614b58575b50614a98575b5050507f4fa9693cae526341d334e2862ca2413b2e503f1266255f9e0869fb36e6d89b179291614a8091614712565b92519283523392a35f80808080808080808080614a31565b813b15614b36578651636abd4b7b60e01b8152818101869052838160248183875af18015614b4e57908491614b3a575b5050873b15614b3657865163b66503cf60e01b81526001600160a01b03909216908201908152602081018590528290829081906040010381838b5af18015614b2c57614b15575b80614a51565b614b1f82916141c4565b614b295780614b0f565b80fd5b86513d84823e3d90fd5b8280fd5b614b43906141c4565b614b3657825f614ac8565b88513d86823e3d90fd5b60025416893b1561040d57885163b66503cf60e01b81526001600160a01b0391909116838201908152602081018790525f90829081900360400181838e5af18015614bb55715614a4b57614bad9194506141c4565b5f925f614a4b565b89513d5f823e3d90fd5b62093a808904158015614bd9575b15614a2c57505f614a2c565b5060248a8d8d5192838092634cde602960e11b82528b8b8301525afa908115614c38575f91614c0b575b508910614bcd565b90508a81813d8311614c31575b614c228183614224565b8101031261040d57515f614c03565b503d614c18565b8c513d5f823e3d90fd5b62093a808704158015614c5d575b15614a22575f9250614a22565b506002548a51634cde602960e11b81529083168582015289816024818f5afa908115614cbf575f91614c92575b508710614c50565b90508981813d8311614cb8575b614ca98183614224565b8101031261040d57515f614c8a565b503d614c9f565b8b513d5f823e3d90fd5b5050505050505050565b813d8311614cf5575b614ce68183614224565b8101031261040d57835f6149b6565b503d614cdc565b86513d5f823e3d90fd5b5f5b828110614d1457505050565b606082820152602001614d08565b3d15614d5c573d9067ffffffffffffffff82116141d85760405191614d51601f8201601f191660200184614224565b82523d5f602084013e565b606090565b15614d6857565b60405162461bcd60e51b815260206004820152600560248201527f3e313030250000000000000000000000000000000000000000000000000000006044820152606490fd5b6001600160a01b03165f526020805260ff60405f205416614dce57601e5490565b601f60205260405f205490565b91908110156145a45760051b81013590601e198136030182121561040d57019081359167ffffffffffffffff831161040d576020018260051b3603811361040d579190565b805f52602090600f8252604090815f2080545f915f5b828110614e9057505050614e4c9060085461496d565b6008555f52601082525f81812055600f82525f20908154915f815582614e7157505050565b5f525f20908101905b818110614e85575050565b5f8155600101614e7a565b614e9a81836145b8565b906001600160a01b03918291549060031b1c1690865f5288600e92838252895f20815f52825289805f2054948515159081614edf575b50505050505050600101614e36565b90869a9691600a95868152614ef888865f205416615386565b855f52600d8152845f20614f0d85825461496d565b90558d5f52528d835f2090855f5252825f20614f2a83825461496d565b905515614fe15750505f52895280885f2054165f52600c8952875f205416803b1561040d575f809160448a518094819363278afc8b60e21b83528b60048401528c60248401525af18015614fd757614faf87600195947fa9f3ca5f8a9e1580edb2741e0ba560084ec72e0067ba3423f9e9327a176882db948c94614fc8575b50614712565b965b8151908982528b820152a1905f8881898180614ed0565b614fd1906141c4565b5f614fa9565b88513d5f823e3d90fd5b9092507fa9f3ca5f8a9e1580edb2741e0ba560084ec72e0067ba3423f9e9327a176882db935061501591506001959461496d565b96614fb1565b9091815f52602360205260ff60405f2054166153365761503a82614e20565b82516001600160a01b0360205f546024604051809481936339f890b560e21b835289600484015260101c165afa908115610492575f91615304575b505f925f935f965f5b8581106152e557505f5b85811061511357505050505050826150b8575b6150a790600854614712565b6008555f52601060205260405f2055565b6001600160a01b035f5460101c1690813b1561040d575f809260246040518095819363fd4a77f160e01b83528860048401525af1918215610492576150a792615104575b50905061509b565b61510d906141c4565b5f6150fc565b6001600160a01b03615125828461466c565b5116805f52600a6020526001600160a01b0360405f205416805f52601260205260ff60405f205416806152d2575b615162575b5050600101615088565b615185856151808961517a879d9f978b9e979e61466c565b516147ed565b6147cf565b988a5f52600e60205260405f20815f5260205260405f205461040d57891561040d576151b082615386565b8a5f52600f60205260405f208054680100000000000000008110156141d8576151de916001820181556145b8565b81549060031b906001600160a01b0384831b921b1916179055805f52600d60205260405f2061520e8b8254614712565b90558a5f52600e60205260405f20905f5260205260405f206152318a8254614712565b90555f52600c6020526001600160a01b0360405f20541691823b1561040d575f8a60448b83604051978894859363f320772360e01b8552600485015260248401525af1908115610492576152928a809260019661529895614fc85750614712565b9b614712565b97604051908a825260208201527fea66f58e474bc09f580000e81f31b334d171db387d0c6098ba47bd897741679b60403392a2905f615158565b50601460205260ff60405f205416615153565b916152fd6001916152f6858761466c565b5190614712565b920161507e565b90506020813d60201161532e575b8161531f60209383614224565b8101031261040d57515f615075565b3d9150615312565b60405162461bcd60e51b815260206004820152602260248201527f5374616c65204e46542c20706c6561736520636f6e7461637420746865207465604482015261616d60f01b6064820152608490fd5b6001600160a01b0380911690815f52600b60205260405f2054165f52600d60205260405f2054815f52601760205260405f208054908115155f1461541f57906153d49160165480915561496d565b9081151580615416575b6153e757505050565b670de0b6b3a7640000916153fa916147ed565b04905f52601860205261541260405f20918254614712565b9055565b508015156153de565b6016549055505050565b6001600160a01b0316805f52601360205260405f20805460ff811661040d5760ff19166001179055337f6661a7108aecd07864384529117d96c319c1163e3010c01390f6b704726e07de5f80a356fea164736f6c6343000818000a

Deployed Bytecode

0x6080806040526004361015610012575f80fd5b5f3560e01c908162bf3d7c14614143575080630675f276146140b357806306d6a1b21461407a578063075461721461405457806308828eb7146140355780630c340a241461400f5780631123363414613f8f5780631703e5f914613fd25780631f7b6d3214613fb55780631fa2d73c14613f8f57806320b1cb6f14613eb45780632920ae2514613dff5780632fe3c1e514613de2578063310bd74b14613c8f57806332145f9014613bc3578063328285c414613a345780633af32abf146139f75780633c6b16ab146138d65780633e952971146134e6578063402914f5146134ae578063411b1f77146133bc57806342a82b4f1461314a578063436596c4146130e057806344c43782146130ba57806347317bad1461301257806349c06a2214612f5d5780634f2bd32914612f245780635001f3b514612efe57806350d976fc14612e7b578063528cfa9814612e5f57806353d7869314612e2c57806360e64bc614612d30578063618fee6c14612c8b57806363453ae114612c53578063666256aa14612ab557806368c3acb314612c2d578063698473e314612ad65780636ecbe38a14612aba5780637715ee7514612ab55780637778960e14612a8f5780637868f5eb14612a5657806379e9382414612a2c5780637ac09bf7146128765780637bdd4465146128505780637bebe3811461282a5780637cf892f6146127b75780637ee8a2c314612752578063831763a61461264b5780638dd598fb1461262357806391f36633146123155780639647d141146122ef57806396c82e57146122d257806398bbc3c7146122ac578063992a7933146121505780639b19251a146121025780639b6a9d72146120af5780639e37878c146120725780639f06247b14611f13578063a0b1e80414611e41578063a3bb099014611d23578063a4b5820614611b6c578063a5f4301e146115b1578063a61c713a1461153c578063a69a543114611511578063a7cac846146114d9578063a86a366d146114a1578063aa79979b14611464578063ac4afa3814611423578063b65f5126146113f4578063b9a09fd5146113bb578063bba2e5b5146111d0578063c42cf5351461118d578063c45a015514611167578063c527ee1f1461106a578063ce9a4e9e14610ff4578063d23254b414610faf578063d560b0d714610f4e578063da77122d14610dba578063dce1de431461098b578063de7d72e5146108d7578063deeb07c11461084f578063e586875f1461080c578063e74f6166146107e6578063ea94ee4414610783578063eab37eec146104ed578063eddaa0e9146104aa578063efd9bf92146104115763f3594be0146103e3575f80fd5b3461040d57602036600319011261040d576004355f526011602052602060405f2054604051908152f35b5f80fd5b3461040d57604036600319011261040d5761042a61416e565b610432614184565b6001600160a01b03809281601d54163314801561049d575b610453906146bc565b1691823b1561040d5760245f928360405195869485936339ced26d60e21b85521660048401525af180156104925761048757005b610490906141c4565b005b6040513d5f823e3d90fd5b506006548216331461044a565b3461040d57602036600319011261040d576104c361416e565b6001600160a01b03908160065416330361040d57166001600160a01b0319601d541617601d555f80f35b3461040d57606036600319011261040d5767ffffffffffffffff60043581811161040d5761051f903690600401614352565b60243583811161040d57610537903690600401614352565b91909360443590811161040d57610552903690600401614352565b90926001600160a01b03601b5416945f925b84841061056d57005b5f5b61057a858389614ddb565b9050811015610778576105988161059287858b614ddb565b906146ee565b6040516331a9108f60e11b8152903560048201526020816024818c5afa8015610492575f90610738575b6001600160a01b03915016331480156106ac575b1561040d576001600160a01b036105f66105f18789876146ee565b6146fe565b16906106078161059288868c614ddb565b359161061487878d614ddb565b823b1561040d57604080516353c2957d60e11b81526004810196909652602486015260448501819052849160648301915f905b8082106106805750505091815f81819503925af191821561049257600192610671575b500161056f565b61067a906141c4565b8a61066a565b919350916020806001926001600160a01b0361069b886141b0565b168152019401920186939291610647565b506106bc8161059287858b614ddb565b60405163020604bf60e21b8152903560048201526020816024818c5afa8015610492575f906106f8575b6001600160a01b0391501633146105d6565b506020813d602011610730575b8161071260209383614224565b8101031261040d5761072b6001600160a01b0391614832565b6106e6565b3d9150610705565b506020813d602011610770575b8161075260209383614224565b8101031261040d5761076b6001600160a01b0391614832565b6105c2565b3d9150610745565b509260010192610564565b3461040d5761079136614545565b919091335f52601260205260ff60405f2054161561040d5760405191825260208201527ff341246adaac6f497bc2a656f546ab9e182111d630394f0c57c710a59a2cb56760406001600160a01b0333941692a3005b3461040d575f36600319011261040d5760206001600160a01b0360195416604051908152f35b3461040d57602036600319011261040d5761082561416e565b600754906001600160a01b03808316330361040d576001600160a01b031991169116176007555f80f35b3461040d57602036600319011261040d576004356108836001600160a01b0380601d541633149081156108c9575b506146bc565b610891612710821115614d61565b5f7fae82f56546faac02afaec59c20cab0ed4cb15bb32ad1be67ed0bcecd49cbde846040601e548151908152846020820152a2601e55005b90506006541633148361087d565b3461040d57604036600319011261040d576108f061416e565b6108f86143ce565b906001600160a01b039081601d54163314801561097e575b610919906146bc565b1690815f52602160205260405f2060ff81541691801515809315150361093b57005b610950919060ff801983541691151516179055565b6040519081527fc226090c79560682a4254f61540d22465b1f23522ee477acb0a520160d3c3e0460203392a3005b5060065482163314610910565b3461040d57606036600319011261040d576109a461416e565b6109ac614184565b60443567ffffffffffffffff811161040d576109cc903690600401614352565b6001600160a01b039384600654163303610d75575f91856004541693604051968791630317318f60e11b8352818516968760048501526020998a91816024998a925af1928315610492575f93610d3f575b505f9293898388541688604051809781936301126ca960e21b83528d60048401525af1938415610492575f94610d08575b505f5b818110610cab575050508060025416916040519763095ea7b360e01b808a52838316998a60048201528b815f1997888c830152815a6044925f91f18015610492578c928c92604492610c8e575b505f87601c5416604051998a958694855260048501528d8401525af1938415610492578996610b468594610b4b938e98610c61575b50895f52600c8852601260405f20986001600160a01b031999888c168b8254161790558d5f52600a815260405f208c8b8254161790558b5f52600b81528d60405f20908b825416179055528d601460405f209160ff199260018482541617905552600160405f2091825416179055615386565b61492a565b169485610ba0575b5050604080513381526001600160a01b0390931660208401527f89db950816d6b0f68e51bad00bf438fa35268fcbe53cc183011d7c9b9baaa2a7929150819081015b0390a4604051908152f35b9091929350845f52600a88528160405f2054165f526014885260ff60405f205416610c1e575085927f89db950816d6b0f68e51bad00bf438fa35268fcbe53cc183011d7c9b9baaa2a792610c04610b9593875f5260258b5260405f20541615614846565b855f52602589528460405f20918254161790559188610b53565b87600c6064926040519262461bcd60e51b845260048401528201527f41637469766520676175676500000000000000000000000000000000000000006044820152fd5b610c8090893d8b11610c87575b610c788183614224565b81019061476b565b508e610ad3565b503d610c6e565b610ca490853d8711610c8757610c788183614224565b508e610a9e565b83851690610cbd6105f18285876146ee565b823b1561040d57858a5f9283604051968794859363db89461b60e01b85521660048401525af191821561049257600192610cf9575b5001610a51565b610d02906141c4565b8c610cf2565b9093508981813d8311610d38575b610d208183614224565b8101031261040d57610d3190614832565b928a610a4e565b503d610d16565b92508883813d8311610d6e575b610d568183614224565b8101031261040d57610d685f93614832565b92610a1d565b503d610d4c565b60405162461bcd60e51b815260206004820152600560248201527f21415554480000000000000000000000000000000000000000000000000000006044820152606490fd5b3461040d5760208060031936011261040d5760043567ffffffffffffffff811161040d57610ded60049136908301614352565b9190926001600160a01b039283601d541633148015610f41575b610e10906146bc565b81846005541660405194858092631a2732c160e31b82525afa928315610492575f93610f12575b5062093a8092838101809111610efe57610e5290421061471f565b5f93834204848102948186041490151715945b828110610e6e57005b85610efe57610e7e8184896146ee565b355f52601184528460405f2055610e9f610e9982858a6146ee565b35614e20565b815f5460101c1690610eb281858a6146ee565b35823b1561040d575f9260248492604051958693849263c1f0fb9f60e01b845260048401525af191821561049257600192610eef575b5001610e65565b610ef8906141c4565b88610ee8565b634e487b7160e01b5f52601160045260245ffd5b9092508181813d8311610f3a575b610f2a8183614224565b8101031261040d57519185610e37565b503d610f20565b5060065484163314610e07565b3461040d57602036600319011261040d5760043567ffffffffffffffff811161040d57610f7f9036906004016142b4565b5f5b81518110156104905780610fa96001600160a01b03610fa26001948661466c565b5116615386565b01610f81565b3461040d57604036600319011261040d57610fc8614184565b6004355f52600e6020526001600160a01b0360405f2091165f52602052602060405f2054604051908152f35b3461040d57602036600319011261040d576001600160a01b0380601d54163314801561105d575b611024906146bc565b5f5460101c16803b1561040d575f8091602460405180948193634c35bec560e11b835260043560048401525af180156104925761048757005b506006548116331461101b565b3461040d5760208060031936011261040d5760043567ffffffffffffffff811161040d5761109c9036906004016142b4565b905f5b8251811015610490576001600160a01b03600483826110be858861466c565b51166040519283809263e574821360e01b82525afa908115610492575f9161114a575b506110f0575b5060010161109f565b60405f916110fe848761466c565b5116600482518094819363d294f09360e01b83525af1801561049257156110e757604090813d8311611143575b6111358183614224565b8101031261040d57836110e7565b503d61112b565b6111619150843d8611610c8757610c788183614224565b856110e1565b3461040d575f36600319011261040d5760206001600160a01b0360015416604051908152f35b3461040d57602036600319011261040d576111a661416e565b600654906001600160a01b03808316330361040d576001600160a01b031991169116176006555f80f35b3461040d5760208060031936011261040d576111ea61416e565b906101035f5460ff8160081c1615806113ae575b611207906145cd565b61ffff1916175f556001600160a01b0391826006541633148015611382575b1561040d57821691826001600160a01b0319601c541617601c555f7fae82f56546faac02afaec59c20cab0ed4cb15bb32ad1be67ed0bcecd49cbde84604061138880601e5581519084825286820152a28060025416906040519163095ea7b360e01b908184528560048501525f199160249483602482015286816044815f82975af1801561049257611365575b50600954935f5b8581106112f6577f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024988861ff00195f54165f5560405160038152a1005b8082611302879361456f565b90549060031b1c165f52600a89528888868c5f876040822054169160405197889586948c865260048601528401525af191821561049257600192611348575b50016112ba565b61135e908a3d8c11610c8757610c788183614224565b508a611341565b61137b90873d8911610c8757610c788183614224565b50876112b3565b50827fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610354163314611226565b50600360ff8216106111fe565b3461040d57602036600319011261040d5760206001600160a01b03806113df61416e565b165f52600a825260405f205416604051908152f35b3461040d57602036600319011261040d576004355f526023602052602060ff60405f2054166040519015158152f35b3461040d57602036600319011261040d5760043560095481101561040d576001600160a01b0361145460209261456f565b9190546040519260031b1c168152f35b3461040d57602036600319011261040d576001600160a01b0361148561416e565b165f526012602052602060ff60405f2054166040519015158152f35b3461040d576114af3661452f565b905f52600f60205260405f2090815481101561040d576114546001600160a01b03916020936145b8565b3461040d57602036600319011261040d576001600160a01b036114fa61416e565b165f52600d602052602060405f2054604051908152f35b3461040d57602036600319011261040d57602061153461152f61416e565b614dad565b604051908152f35b3461040d5761154a36614545565b919091335f52601260205260ff60405f2054161561040d57601460205260ff60405f2054161561040d5760405191825260208201527fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d760406001600160a01b0333941692a3005b3461040d5760208060031936011261040d576115cb61416e565b6001600160a01b03908282821691825f52600a82526115f08460405f20541615614846565b8360015416906040519283809363e5e31b1360e01b825286600483015260249485915afa928315610492575f93611b4d575b508215611b09576060855f945f90611970575b5f95826006541633036118fc575b50508790600454168460405180978193630317318f60e11b83528a60048401525af1938415610492575f946118c0575b50906116c99187876003541691885f5460101c1692895f8a60405198899586948593630f6f2d4760e11b855260048501528d1698898d85015260448401526001606484015260a0608484015260a4830190614680565b03925af1928315610492575f93611889575b508660025416926040519763095ea7b360e01b90818a52808316998a60048201528b815f1998898b830152815a6044925f91f1928315610492575f8c936044938f9661186c575b50601c5416604051998a958694855260048501528b8401525af1918215610492576117be94610b469361184f575b50885f52600c8a5260405f206001600160a01b03199182825416179055875f52600a8a5260405f208982825416179055885f52600b8a528760405f20918254161790556012895260405f2060ff199060018282541617905560148a52600160405f2091825416179055615386565b823b1561040d575f6040518092635b8d276760e11b8252600160048301528183875af180156104925784927f48d3c521fd0d5541640f58c6d6381eed7cb2e8c9df421ae165a4f4c2d221ee0d9261183592611840575b50604080513381526001600160a01b03909216602083015290918291820190565b0390a3604051908152f35b611849906141c4565b87611814565b611865908b3d8d11610c8757610c788183614224565b508a611750565b61188290873d8911610c8757610c788183614224565b508f611722565b9092508781813d83116118b9575b6118a18183614224565b8101031261040d576118b290614832565b91886116db565b503d611897565b919093508682813d83116118f5575b6118d98183614224565b8101031261040d576118ed6116c992614832565b939091611673565b503d6118cf565b821680875260218a5260ff604088205416158061195c575b61191d90614892565b86526013895260ff6040872054169081611945575b5061193d91506148de565b858880611643565b905016845261193d60ff6040862054168791611932565b508183168752604087205460ff1615611914565b505050909150604051634eb1c24560e11b8152604081600481875afa908115610492575f905f92611ac2575b508190808760025416938882169185831492838015611ab7575b15611a465750604051926080840184811067ffffffffffffffff821117611a33578b95935f9a999897959387938f606090611a1f956040526003885236908801378599611a028761463f565b5284601c5416611a118761464c565b528c14611a2b57509261465c565b911690525b9550611635565b90509261465c565b89634e487b7160e01b5f5260416004525ffd5b92505060405191611a56836141ec565b600483526080368c8501378295611a6c8461463f565b5289601c5416611a7b8461464c565b52611a858361465c565b52815160031015611aa45788166080909101525f949392918791611a24565b86634e487b7160e01b5f5260326004525ffd5b50868b8416146119b6565b9150506040813d604011611b01575b81611ade60409383614224565b8101031261040d57611afa86611af383614832565b9201614832565b908761199c565b3d9150611ad1565b60405162461bcd60e51b8152600481018790526006818401527f215f706f6f6c00000000000000000000000000000000000000000000000000006044820152606490fd5b611b65919350863d8811610c8757610c788183614224565b9186611622565b3461040d5760208060031936011261040d5760043567ffffffffffffffff811161040d57611b9e903690600401614352565b90916001600160a01b0380601d541633148015611d16575b611bbf906146bc565b5f82826005541660046040518094819363ed29fc1160e01b83525af1908115610492578391611ced575b50505f5b838110611bf657005b611c0c611c076105f18387896146ee565b615386565b81611c1b6105f18387896146ee565b165f526014835260ff60405f20541615611c38575b600101611bed565b81611c476105f18387896146ee565b165f5260189081845260405f20549183611c656105f184898b6146ee565b165f5284525f60408120558382611c7f575b509050611c30565b60025460065460405163a9059cbb60e01b81529086166001600160a01b03166004820152602481019490945283908516815f816044810103925af191821561049257600192611cd0575b5083611c77565b611ce690853d8711610c8757610c788183614224565b5086611cc9565b813d8311611d0f575b611d008183614224565b8101031261040d578185611be9565b503d611cf6565b5060065481163314611bb6565b3461040d57611d3136614383565b6001600160a01b03939192939283601d541633148015611e34575b611d55906146bc565b818503611def575f5b858110611d6757005b80611d7560019285856146ee565b35611d84612710821115614d61565b7fae82f56546faac02afaec59c20cab0ed4cb15bb32ad1be67ed0bcecd49cbde846040611db56105f1858c8b6146ee565b89611dbf82614dad565b911693845f526020601f815281845f2055808052835f208860ff198254161790558351928352820152a201611d5e565b60405162461bcd60e51b815260206004820152600f60248201527f6c656e677468206d69736d6174636800000000000000000000000000000000006044820152606490fd5b5060065484163314611d4c565b3461040d5760208060031936011261040d5760043567ffffffffffffffff811161040d57611e73903690600401614352565b916001600160a01b039182601d541633148015611f06575b611e94906146bc565b601e54935f5b818110611ea357005b80611eb46105f160019385876146ee565b7fae82f56546faac02afaec59c20cab0ed4cb15bb32ad1be67ed0bcecd49cbde84604088611ee184614dad565b931692835f52888052815f2060ff19815416905581519081528a89820152a201611e9a565b5060065483163314611e8b565b3461040d5760208060031936011261040d57611f2d61416e565b906001600160a01b03809281601d541633148015612065575b611f4f906146bc565b1691825f526014825260ff60405f205416612020575f80918482526014845260408220600160ff19825416179055600b84526040822054169260405190810190636373ea6960e01b825260048152611fa681614208565b5190845afa611fb3614d22565b50611fe0575b507fed18e9faa3dccfd8aa45f69c4de40546b2ca9cccc4538a2323531656516db1aa5f80a2005b803b1561040d575f8091602460405180948193635b8d276760e11b8352600160048401525af180156104925715611fb95761201a906141c4565b81611fb9565b60405162461bcd60e51b815260048101839052601360248201527f676175676520616c726561647920616c697665000000000000000000000000006044820152606490fd5b5060065482163314611f46565b3461040d57602036600319011261040d576001600160a01b0361209361416e565b165f526021602052602060ff60405f2054166040519015158152f35b3461040d576120bd3661452f565b905b8181106120c857005b806120fc6120d760019361456f565b906001600160a01b03918291549060031b1c165f52600a60205260405f205416615386565b016120bf565b3461040d57602036600319011261040d5761049061211e61416e565b61213d6001600160a01b0380601d5416331490811561214257506146bc565b615429565b90506006541633148461087d565b3461040d5760208060031936011261040d5761216a61416e565b906001600160a01b03809281601d54163314801561229f575b61218c906146bc565b1691825f526014825260ff60405f2054161561225a575f8091848252601484526040822060ff198154169055600b84526040822054169260405190810190636373ea6960e01b8252600481526121e181614208565b5190845afa6121ee614d22565b5061221b575b507f04a5d3f5d80d22d9345acc80618f4a4e7e663cf9e1aed23b57d975acec002ba75f80a2005b803b1561040d575f8091602460405180948193635b8d276760e11b83528160048401525af1801561049257156121f457612254906141c4565b816121f4565b60405162461bcd60e51b815260048101839052601260248201527f676175676520616c7265616479206465616400000000000000000000000000006044820152606490fd5b5060065482163314612183565b3461040d575f36600319011261040d5760206001600160a01b03601b5416604051908152f35b3461040d575f36600319011261040d576020600854604051908152f35b3461040d575f36600319011261040d5760206001600160a01b0360045416604051908152f35b3461040d5761232f6123263661452f565b9080929161496d565b90600182018211610efe579061234760018201614246565b906123556040519283614224565b6001810180835261236590614246565b926123786020840194601f190185614d06565b61238460018301614246565b916123926040519384614224565b6001810183526123b46123a760018301614246565b601f190160208501614d06565b5f5b6001820181106124d6575050506040519160408301906040845251809152606083019060608160051b85010194915f905b82821061247757505050508183036020830152805180845260208401906020808260051b8701019301915f905b8282106124215785850386f35b90919293601f19878203018252845190602080835192838152019201905f905b80821061245f57505050602080600192960192019201909291612414565b90919260208060019286518152019401920190612441565b90919295605f19868203018252865190602080835192838152019201905f905b8082106124b5575050506020806001929801920192019092916123e7565b9091926020806001926001600160a01b038751168152019401920190612497565b91946124e58387969396614712565b94855f52600f6020526124fb60405f2054614800565b612505858561466c565b52612510848461466c565b50855f52600f60205260405f20604051808260208294549384815201905f5260205f20925f905b8082106125fe57505061254c92500382614224565b612556858561466c565b52612561848461466c565b50855f52600f60205261257760405f2054614800565b612581858761466c565b5261258c848661466c565b505f5b612599858561466c565b51518110156125ee57600190875f52600e60205260405f206001600160a01b036125cd836125c78a8a61466c565b5161466c565b51165f5260205260405f20546125e7826125c7898b61466c565b520161258f565b50909591945090916001016123b6565b916001919350602082916001600160a01b038754168152019401920184929391612537565b3461040d575f36600319011261040d5760206001600160a01b035f5460101c16604051908152f35b3461040d57602036600319011261040d5760043567ffffffffffffffff811161040d5761267c903690600401614352565b6101055f5460ff8160081c161580612745575b612698906145cd565b61ffff1916175f555f5b8181106126df5761ff00195f54165f557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160058152a1005b6001600160a01b035f5460101c16906126f98184866146ee565b35823b1561040d575f9260248492604051958693849263fbd3a29d60e01b845260048401525af191821561049257600192612736575b50016126a2565b61273f906141c4565b8461272f565b50600560ff82161061268f565b3461040d576127603661452f565b905b81811061276b57005b6127748161456f565b906001600160a01b03918291549060031b1c165f52600a60205260405f20541690600160158181540361040d576127b06001946002835561497a565b5501612762565b3461040d57602036600319011261040d5760043567ffffffffffffffff811161040d576127e89036906004016142b4565b5f5b8151811015610490576001600160a01b03612805828461466c565b511690600160158181540361040d576128236001946002835561497a565b55016127ea565b3461040d575f36600319011261040d5760206001600160a01b03601a5416604051908152f35b3461040d575f36600319011261040d5760206001600160a01b0360245416604051908152f35b3461040d57606036600319011261040d5767ffffffffffffffff60043560243582811161040d576128ab903690600401614352565b909260443590811161040d576128c5903690600401614352565b9290916001600160a01b0394856005541691604051968793631a2732c160e31b855284600460209a8b935afa938415610492575f946129fd575b5062093a8093848101809111610efe5761291a90421061471f565b5f5460405163430c208160e01b8152336004820152602481018790529189918391604491839160109190911c165afa801561049257612960915f916129e0575b50614783565b85810361040d57824204838102938185041490151715610efe5761299192845f526011885260405f2055369161425e565b9161299b84614246565b936129a96040519586614224565b8085528585019060051b82019136831161040d57905b8282106129d15761049086868661501b565b813581529086019086016129bf565b6129f79150893d8b11610c8757610c788183614224565b8961295a565b9093508781813d8311612a25575b612a158183614224565b8101031261040d575192886128ff565b503d612a0b565b3461040d57602036600319011261040d576004355f526010602052602060405f2054604051908152f35b3461040d57602036600319011261040d5760206001600160a01b0380612a7a61416e565b165f526025825260405f205416604051908152f35b3461040d575f36600319011261040d5760206001600160a01b0360075416604051908152f35b6143dd565b3461040d57602036600319011261040d57610490611c0761416e565b3461040d57604036600319011261040d57600435612af2614184565b90335f5260206012815260ff60405f2054168015612c07575b1561040d57335f526014815260ff60405f2054168015612be1575b1561040d5781612b68575b7f60940192810a6fb3bce3fd3e2e3a13fd6ccc7605e963fb87ee971aba829989bd906040519283526001600160a01b0333941692a3005b6001600160a01b035f5460101c1690813b1561040d575f809260246040518095819363fbd3a29d60e01b83528860048401525af1918215610492577f60940192810a6fb3bce3fd3e2e3a13fd6ccc7605e963fb87ee971aba829989bd92612bd2575b509050612b31565b612bdb906141c4565b84612bca565b50600a81526001600160a01b0360405f2054165f526012815260ff60405f205416612b26565b50600a81526001600160a01b0360405f2054165f526012815260ff60405f205416612b0b565b3461040d575f36600319011261040d5760206001600160a01b0360035416604051908152f35b3461040d57602036600319011261040d57612c6c61416e565b60016015540361040d57612c8490600260155561497a565b6001601555005b3461040d57602036600319011261040d5760043567ffffffffffffffff811161040d57612cbc903690600401614352565b6001600160a01b0380601c5416925f5b838110612cd557005b82612ce46105f18387866146ee565b1690813b1561040d575f8092602460405180958193633cc7227f60e11b83528b60048401525af191821561049257600192612d21575b5001612ccc565b612d2a906141c4565b86612d1a565b3461040d57606036600319011261040d57612d4961416e565b612d51614184565b90612d5a61419a565b905f549160ff8360081c161580612e1f575b612d75906145cd565b6001600160a01b0390816006541633148015612df3575b1561040d5781600295816001600160a01b031995168560195416176019551683601a541617601a551690601b541617601b5561ffff1916175f557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160028152a1005b50817fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610354163314612d8c565b50600260ff841610612d6c565b3461040d575f36600319011261040d576009545f5b818110612e4a57005b80612e596120d760019361456f565b01612e41565b3461040d575f36600319011261040d5760206040516127108152f35b3461040d57604036600319011261040d57612e9461416e565b612e9c614184565b6001600160a01b03809281601d541633148015612ef1575b612ebd906146bc565b1691823b1561040d5760245f92836040519586948593639dfb338160e01b85521660048401525af180156104925761048757005b5060065482163314612eb4565b3461040d575f36600319011261040d5760206001600160a01b0360025416604051908152f35b3461040d57602036600319011261040d5760206001600160a01b0380612f4861416e565b165f52600c825260405f205416604051908152f35b3461040d57612f6b36614383565b6001600160a01b03939291939182601d541633148015613005575b612f8f906146bc565b5f5b818110612f9a57005b83612fa96105f18385896146ee565b1690612fb96105f182868a6146ee565b823b1561040d578560245f92836040519687948593630c96238f60e01b85521660048401525af191821561049257600192612ff6575b5001612f91565b612fff906141c4565b87612fef565b5060065483163314612f86565b3461040d57604036600319011261040d5760043561302e6143ce565b9061304e6001600160a01b0380601d5416331490811561214257506146bc565b805f526022602052600160ff60405f2054161515036130905761308b61049092825f52602360205260405f209060ff801983541691151516179055565b614e20565b60405162461bcd60e51b8152602060048201526002602482015261021560f41b6044820152606490fd5b3461040d575f36600319011261040d5760206001600160a01b03601d5416604051908152f35b3461040d575f36600319011261040d576009545f5b8181106130fe57005b6131078161456f565b906001600160a01b03918291549060031b1c165f52600a60205260405f20541690600160158181540361040d576131436001946002835561497a565b55016130f5565b3461040d5760e036600319011261040d5761316361416e565b61316b614184565b9061317461419a565b91606435906001600160a01b039182811680910361040d576084359183831680930361040d5760a4359084821680920361040d5760c4359367ffffffffffffffff851161040d576131ca869536906004016142b4565b935f5498602060ff8b60081c1615998a809b6133af575b801561338b575b6131f1906145cd565b60019b8b8d60ff198316175f5561337a575b505f547fffffffffffffffffffff0000000000000000000000000000000000000000ffff75ffffffffffffffffffffffffffffffffffffffff00008360101b169116175f55886001600160a01b03199616868d5416178c556004604051809b8193637e062a3560e11b8352165afa8015610492578a985f91613338575b50908780921685600254161760025516836003541617600355826004541617600455816005541617600555818160065416176006556007541617600755825f905b61330c575b505050601555816016556132d657005b60207f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989161ff00195f54165f55604051908152a1005b8151811015613333578061332c8461332587948661466c565b5116615429565b01836132c1565b6132c6565b919850506020813d602011613372575b8161335560209383614224565b8101031261040d5789978761336a8193614832565b919250613280565b3d9150613348565b61ffff1916610101175f558c613203565b506131f1303b158d816133a1575b5090506131e8565b6001915060ff16148d613399565b50600160ff8d16106131e1565b3461040d57604036600319011261040d576004356133d8614184565b90335f52601260205260ff60405f2054168015613486575b1561040d5780613433575b6040519081527fae268d9aab12f3605f58efd74fd3801fa812b03fdb44317eb70f46dff0e19e2260206001600160a01b0333941692a3005b6001600160a01b035f5460101c16803b1561040d575f8091602460405180948193634c35bec560e11b83528760048401525af1801561049257613477575b506133fb565b613480906141c4565b82613471565b50600a6020526001600160a01b0360405f2054165f52601260205260ff60405f2054166133f0565b3461040d57602036600319011261040d576001600160a01b036134cf61416e565b165f526018602052602060405f2054604051908152f35b3461040d57606036600319011261040d576134ff61416e565b613507614184565b60443562ffffff811680910361040d576001600160a01b038092816019541694604051948591630b4c774160e11b835216958660048301528360249316948584840152604483015281606460209788935afa908115610492575f916138a1575b5082811693841561385d575f9596858752600a885261358c8560408920541615614846565b846006541633036137f4575b50508583600454168360405180988193630317318f60e11b83528960048401525af1928315610492575f936137be575b5f95508681601a541684604051809981936352fa180f60e11b83528a60048401525af1958615610492575f96613787575b508060025416956040519663095ea7b360e01b90818952838316988960048201528a816044815f801996878d8401525af1928315610492575f8b936044938e9661376a575b5087601c5416906040519a8b968795865260048601528401525af1918215610492576136dd94610b469361374d575b50875f52600c895260405f206001600160a01b031991871682825416179055865f52600a895260405f208882825416179055875f52600b89528660405f20918254161790556012885260405f2060ff199060018282541617905560148952600160405f2091825416179055615386565b813b1561040d57604051637b7d549d60e01b81525f8160048183875af180156104925784927f48d3c521fd0d5541640f58c6d6381eed7cb2e8c9df421ae165a4f4c2d221ee0d92611835926118405750604080513381526001600160a01b03909216602083015290918291820190565b613763908a3d8c11610c8757610c788183614224565b508961366d565b61378090873d8911610c8757610c788183614224565b508e61363e565b9095508681813d83116137b7575b61379f8183614224565b8101031261040d576137b090614832565b94876135f9565b503d613795565b92508585813d83116137ed575b6137d58183614224565b8101031261040d576137e75f95614832565b926135c8565b503d6137cb565b8087526021885260ff604088205416158061384b575b61381390614892565b86526013875260ff60408720541680613838575b61383191506148de565b8680613598565b50855261383160ff604087205416613827565b50818752604087205460ff161561380a565b60405162461bcd60e51b8152600481018790526007818501527f6e6f20706f6f6c000000000000000000000000000000000000000000000000006044820152606490fd5b90508481813d83116138cf575b6138b88183614224565b8101031261040d576138c990614832565b86613567565b503d6138ae565b3461040d57602036600319011261040d576004356008546138f357005b6001600160a01b038060025416803b1561040d575f80916040518260208201916323b872dd60e01b83523360248201523060448201528760648201526064815261393c816141ec565b51925af1613948614d22565b816139c8575b501561040d57670de0b6b3a7640000808302908382041483151715610efe57600854613979916147cf565b806139b3575b5060025416906040519081527ff70d5c697de7ea828df48e5c4573cb2194c659f1901f70110c52b066dcf5082660203392a3005b6139bf90601654614712565b6016558261397f565b80518015925082156139dd575b50508361394e565b6139f0925060208091830101910161476b565b83806139d5565b3461040d57602036600319011261040d576001600160a01b03613a1861416e565b165f526013602052602060ff60405f2054166040519015158152f35b3461040d57604036600319011261040d57600435613a506143ce565b6001600160a01b0380601d541633148015613bb6575b613a6f906146bc565b81158080613ba0575b613b87575b8280613b70575b15613af357505f5460101c1691823b1561040d575f809360246040518096819363fbd3a29d60e01b83528660048401525af19283156104925761049093613ae4575b505b5f52602260205260405f209060ff801983541691151516179055565b613aed906141c4565b83613ac6565b80613b5a575b613b08575b5061049091613ac8565b5f5460101c1691823b1561040d575f8093602460405180968193634c35bec560e11b83528660048401525af19283156104925761049093613b4b575b5091613afe565b613b54906141c4565b83613b44565b50825f52602260205260ff60405f205416613af9565b50835f52602260205260ff60405f20541615613a84565b835f52602360205260405f2060ff198154169055613a7d565b50835f52602360205260ff60405f205416613a78565b5060065481163314613a66565b3461040d5760208060031936011261040d5760043590815f52600f815260405f206040518082848294549384815201905f52845f20925f5b86828210613c7057505050613c1292500382614224565b805192613c1e84614800565b925f5b858110613c34575050610490935061501b565b600190835f52600e835260405f206001600160a01b03613c54838861466c565b51165f52835260405f2054613c69828861466c565b5201613c21565b85546001600160a01b0316845260019586019587955093019201613bfb565b3461040d5760208060031936011261040d576004359060046001600160a01b039180836005541660405193848092631a2732c160e31b82525afa918215610492575f92613db3575b5062093a8091828101809111610efe57613cf290421061471f565b5f5460405163430c208160e01b8152336004820152602481018690529082908290604490829060101c88165afa801561049257613d35915f91613d965750614783565b814204828102928184041490151715610efe57601190845f525260405f2055613d5d82614e20565b5f5460101c1690813b1561040d575f9160248392604051948593849263c1f0fb9f60e01b845260048401525af180156104925761048757005b613dad9150833d8511610c8757610c788183614224565b8661295a565b9080925081813d8311613ddb575b613dcb8183614224565b8101031261040d57519084613cd7565b503d613dc1565b3461040d575f36600319011261040d576020601e54604051908152f35b3461040d57613e0d36614383565b6001600160a01b03939291939182601d541633148015613ea7575b613e31906146bc565b5f5b818110613e3c57005b83613e4b6105f18385896146ee565b1690613e5b6105f182868a6146ee565b823b1561040d578560245f92836040519687948593633cc7227f60e11b85521660048401525af191821561049257600192613e98575b5001613e33565b613ea1906141c4565b87613e91565b5060065483163314613e28565b3461040d57604036600319011261040d5767ffffffffffffffff60043581811161040d57613ee69036906004016142b4565b60249160243590811161040d57613f019036906004016142d2565b915f5b8251811015610490576001600160a01b03613f1f828561466c565b511690613f2c818661466c565b5191803b1561040d57613f665f939184926040519586809481936331279d3d60e01b835233600484015260408b8401526044830190614680565b03925af191821561049257600192613f80575b5001613f04565b613f89906141c4565b85613f79565b3461040d575f36600319011261040d5760206001600160a01b03601c5416604051908152f35b3461040d575f36600319011261040d576020600954604051908152f35b3461040d57602036600319011261040d576001600160a01b03613ff361416e565b165f526014602052602060ff60405f2054166040519015158152f35b3461040d575f36600319011261040d5760206001600160a01b0360065416604051908152f35b3461040d575f36600319011261040d57602060ff5f5416604051908152f35b3461040d575f36600319011261040d5760206001600160a01b0360055416604051908152f35b3461040d57602036600319011261040d5760206001600160a01b038061409e61416e565b165f52600b825260405f205416604051908152f35b3461040d57602036600319011261040d5760046140ce61416e565b6001600160a01b035f549160ff8360081c161580614137575b6140f0906145cd565b166001600160a01b0319602454161760245561ffff1916175f557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160048152a1005b5060ff831684116140e7565b3461040d57602036600319011261040d576020906004355f526022825260ff60405f20541615158152f35b600435906001600160a01b038216820361040d57565b602435906001600160a01b038216820361040d57565b604435906001600160a01b038216820361040d57565b35906001600160a01b038216820361040d57565b67ffffffffffffffff81116141d857604052565b634e487b7160e01b5f52604160045260245ffd5b60a0810190811067ffffffffffffffff8211176141d857604052565b6040810190811067ffffffffffffffff8211176141d857604052565b90601f8019910116810190811067ffffffffffffffff8211176141d857604052565b67ffffffffffffffff81116141d85760051b60200190565b929161426982614246565b916142776040519384614224565b829481845260208094019160051b810192831161040d57905b82821061429d5750505050565b8380916142a9846141b0565b815201910190614290565b9080601f8301121561040d578160206142cf9335910161425e565b90565b81601f8201121561040d578035916020916142ec84614246565b936142fa6040519586614224565b808552838086019160051b8301019280841161040d57848301915b8483106143255750505050505090565b823567ffffffffffffffff811161040d578691614347848480948901016142b4565b815201920191614315565b9181601f8401121561040d5782359167ffffffffffffffff831161040d576020808501948460051b01011161040d57565b604060031982011261040d5767ffffffffffffffff9160043583811161040d57826143b091600401614352565b9390939260243591821161040d576143ca91600401614352565b9091565b60243590811515820361040d57565b3461040d57606036600319011261040d5767ffffffffffffffff6004803582811161040d576144109036906004016142b4565b9060249260243590811161040d5761442c9036906004016142d2565b5f546040805163430c208160e01b815233600482015260448035602483018190529297909490939092916001600160a01b039160209082908890829060101c86165afa908115610492575f91614510575b501561040d575f5b87518110156104905781614499828a61466c565b5116906144a6818661466c565b5191803b1561040d57865f9186838c8f976144dd908e8a519a8b98899788966353c2957d60e11b8852870152850152830190614680565b03925af1918215614506576001926144f7575b5001614485565b614500906141c4565b5f6144f0565b8a513d5f823e3d90fd5b614529915060203d602011610c8757610c788183614224565b5f61447d565b604090600319011261040d576004359060243590565b606090600319011261040d57600435906024356001600160a01b038116810361040d579060443590565b6009548110156145a45760095f527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af01905f90565b634e487b7160e01b5f52603260045260245ffd5b80548210156145a4575f5260205f2001905f90565b156145d457565b60405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608490fd5b8051156145a45760200190565b8051600110156145a45760400190565b8051600210156145a45760600190565b80518210156145a45760209160051b010190565b9081518082526020808093019301915f5b82811061469f575050505090565b83516001600160a01b031685529381019392810192600101614691565b156146c357565b606460405162461bcd60e51b81526020600482015260046024820152630c2eae8d60e31b6044820152fd5b91908110156145a45760051b0190565b356001600160a01b038116810361040d5790565b91908201809211610efe57565b1561472657565b60405162461bcd60e51b815260206004820152600d60248201527f5550444154455f504552494f44000000000000000000000000000000000000006044820152606490fd5b9081602091031261040d5751801515810361040d5790565b1561478a57565b60405162461bcd60e51b815260206004820152600960248201527f21617070726f76656400000000000000000000000000000000000000000000006044820152606490fd5b81156147d9570490565b634e487b7160e01b5f52601260045260245ffd5b81810292918115918404141715610efe57565b9061480a82614246565b6148176040519182614224565b8281528092614828601f1991614246565b0190602036910137565b51906001600160a01b038216820361040d57565b1561484d57565b60405162461bcd60e51b815260206004820152600660248201527f65786973747300000000000000000000000000000000000000000000000000006044820152606490fd5b1561489957565b60405162461bcd60e51b815260206004820152600960248201527f466f7262696464656e00000000000000000000000000000000000000000000006044820152606490fd5b156148e557565b60405162461bcd60e51b815260206004820152600c60248201527f2177686974656c697374656400000000000000000000000000000000000000006044820152606490fd5b600954680100000000000000008110156141d85780600161494e920160095561456f565b6001600160a01b039291928084549260031b9316831b921b1916179055565b91908203918211610efe57565b6005545f906001600160a01b03806040938451809463ed29fc1160e01b82526020958691815f6004988993165af18015614cfc57908591614cd3575b50506149c186615386565b81861695865f526014855260ff865f2054166149e1575b50505050505050565b60188552855f2054938415614cc957614a15612710614a0d614a0787601c541695614dad565b886147ed565b04809661496d565b9360019085151580614c42575b8715159283614bbf575b614a3a575b505050506149d8565b8a5f52601889525f8a812055614b58575b50614a98575b5050507f4fa9693cae526341d334e2862ca2413b2e503f1266255f9e0869fb36e6d89b179291614a8091614712565b92519283523392a35f80808080808080808080614a31565b813b15614b36578651636abd4b7b60e01b8152818101869052838160248183875af18015614b4e57908491614b3a575b5050873b15614b3657865163b66503cf60e01b81526001600160a01b03909216908201908152602081018590528290829081906040010381838b5af18015614b2c57614b15575b80614a51565b614b1f82916141c4565b614b295780614b0f565b80fd5b86513d84823e3d90fd5b8280fd5b614b43906141c4565b614b3657825f614ac8565b88513d86823e3d90fd5b60025416893b1561040d57885163b66503cf60e01b81526001600160a01b0391909116838201908152602081018790525f90829081900360400181838e5af18015614bb55715614a4b57614bad9194506141c4565b5f925f614a4b565b89513d5f823e3d90fd5b62093a808904158015614bd9575b15614a2c57505f614a2c565b5060248a8d8d5192838092634cde602960e11b82528b8b8301525afa908115614c38575f91614c0b575b508910614bcd565b90508a81813d8311614c31575b614c228183614224565b8101031261040d57515f614c03565b503d614c18565b8c513d5f823e3d90fd5b62093a808704158015614c5d575b15614a22575f9250614a22565b506002548a51634cde602960e11b81529083168582015289816024818f5afa908115614cbf575f91614c92575b508710614c50565b90508981813d8311614cb8575b614ca98183614224565b8101031261040d57515f614c8a565b503d614c9f565b8b513d5f823e3d90fd5b5050505050505050565b813d8311614cf5575b614ce68183614224565b8101031261040d57835f6149b6565b503d614cdc565b86513d5f823e3d90fd5b5f5b828110614d1457505050565b606082820152602001614d08565b3d15614d5c573d9067ffffffffffffffff82116141d85760405191614d51601f8201601f191660200184614224565b82523d5f602084013e565b606090565b15614d6857565b60405162461bcd60e51b815260206004820152600560248201527f3e313030250000000000000000000000000000000000000000000000000000006044820152606490fd5b6001600160a01b03165f526020805260ff60405f205416614dce57601e5490565b601f60205260405f205490565b91908110156145a45760051b81013590601e198136030182121561040d57019081359167ffffffffffffffff831161040d576020018260051b3603811361040d579190565b805f52602090600f8252604090815f2080545f915f5b828110614e9057505050614e4c9060085461496d565b6008555f52601082525f81812055600f82525f20908154915f815582614e7157505050565b5f525f20908101905b818110614e85575050565b5f8155600101614e7a565b614e9a81836145b8565b906001600160a01b03918291549060031b1c1690865f5288600e92838252895f20815f52825289805f2054948515159081614edf575b50505050505050600101614e36565b90869a9691600a95868152614ef888865f205416615386565b855f52600d8152845f20614f0d85825461496d565b90558d5f52528d835f2090855f5252825f20614f2a83825461496d565b905515614fe15750505f52895280885f2054165f52600c8952875f205416803b1561040d575f809160448a518094819363278afc8b60e21b83528b60048401528c60248401525af18015614fd757614faf87600195947fa9f3ca5f8a9e1580edb2741e0ba560084ec72e0067ba3423f9e9327a176882db948c94614fc8575b50614712565b965b8151908982528b820152a1905f8881898180614ed0565b614fd1906141c4565b5f614fa9565b88513d5f823e3d90fd5b9092507fa9f3ca5f8a9e1580edb2741e0ba560084ec72e0067ba3423f9e9327a176882db935061501591506001959461496d565b96614fb1565b9091815f52602360205260ff60405f2054166153365761503a82614e20565b82516001600160a01b0360205f546024604051809481936339f890b560e21b835289600484015260101c165afa908115610492575f91615304575b505f925f935f965f5b8581106152e557505f5b85811061511357505050505050826150b8575b6150a790600854614712565b6008555f52601060205260405f2055565b6001600160a01b035f5460101c1690813b1561040d575f809260246040518095819363fd4a77f160e01b83528860048401525af1918215610492576150a792615104575b50905061509b565b61510d906141c4565b5f6150fc565b6001600160a01b03615125828461466c565b5116805f52600a6020526001600160a01b0360405f205416805f52601260205260ff60405f205416806152d2575b615162575b5050600101615088565b615185856151808961517a879d9f978b9e979e61466c565b516147ed565b6147cf565b988a5f52600e60205260405f20815f5260205260405f205461040d57891561040d576151b082615386565b8a5f52600f60205260405f208054680100000000000000008110156141d8576151de916001820181556145b8565b81549060031b906001600160a01b0384831b921b1916179055805f52600d60205260405f2061520e8b8254614712565b90558a5f52600e60205260405f20905f5260205260405f206152318a8254614712565b90555f52600c6020526001600160a01b0360405f20541691823b1561040d575f8a60448b83604051978894859363f320772360e01b8552600485015260248401525af1908115610492576152928a809260019661529895614fc85750614712565b9b614712565b97604051908a825260208201527fea66f58e474bc09f580000e81f31b334d171db387d0c6098ba47bd897741679b60403392a2905f615158565b50601460205260ff60405f205416615153565b916152fd6001916152f6858761466c565b5190614712565b920161507e565b90506020813d60201161532e575b8161531f60209383614224565b8101031261040d57515f615075565b3d9150615312565b60405162461bcd60e51b815260206004820152602260248201527f5374616c65204e46542c20706c6561736520636f6e7461637420746865207465604482015261616d60f01b6064820152608490fd5b6001600160a01b0380911690815f52600b60205260405f2054165f52600d60205260405f2054815f52601760205260405f208054908115155f1461541f57906153d49160165480915561496d565b9081151580615416575b6153e757505050565b670de0b6b3a7640000916153fa916147ed565b04905f52601860205261541260405f20918254614712565b9055565b508015156153de565b6016549055505050565b6001600160a01b0316805f52601360205260405f20805460ff811661040d5760ff19166001179055337f6661a7108aecd07864384529117d96c319c1163e3010c01390f6b704726e07de5f80a356fea164736f6c6343000818000a

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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