S Price: $0.431598 (-1.29%)

Contract

0xa9Ddae28920f016BDEc448c9fD005aCB5A1B35A4

Overview

S Balance

Sonic LogoSonic LogoSonic Logo0 S

S Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
AccessHub

Compiler Version
v0.8.28+commit.7893614a

Optimization Enabled:
Yes with 1633 runs

Other Settings:
cancun EvmVersion
File 1 of 42 : AccessHub.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.x;

import {IAccessHub} from "./interfaces/IAccessHub.sol";
import {
    AccessControlEnumerableUpgradeable,
    Initializable
} from "@openzeppelin-contracts-upgradeable/access/extensions/AccessControlEnumerableUpgradeable.sol";

import {ILauncherPlugin} from "./interfaces/ILauncherPlugin.sol";
import {IXShadow} from "./interfaces/IXShadow.sol";
import {IX33} from "./interfaces/IX33.sol";

import {IShadowV3Factory} from "./CL/core/interfaces/IShadowV3Factory.sol";
import {IShadowV3Pool} from "./CL/core/interfaces/IShadowV3Pool.sol";
import {IGaugeV3} from "./CL/gauge/interfaces/IGaugeV3.sol";
import {IFeeCollector} from "./CL/gauge/interfaces/IFeeCollector.sol";
import {INonfungiblePositionManager} from "./CL/periphery/interfaces/INonfungiblePositionManager.sol";

import {IPairFactory} from "./interfaces/IPairFactory.sol";
import {IFeeRecipientFactory} from "./interfaces/IFeeRecipientFactory.sol";

import {IVoter} from "./interfaces/IVoter.sol";
import {IMinter} from "./interfaces/IMinter.sol";
import {IVoteModule} from "./interfaces/IVoteModule.sol";

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {Pausable} from "@openzeppelin/contracts/utils/Pausable.sol";

contract AccessHub is IAccessHub, Initializable, AccessControlEnumerableUpgradeable {
    /**
     * Start of Storage Slots
     */

    /// @notice role that can call changing fee splits and swap fees
    bytes32 public constant SWAP_FEE_SETTER = keccak256("SWAP_FEE_SETTER");
    /// @notice operator role
    bytes32 public constant PROTOCOL_OPERATOR = keccak256("PROTOCOL_OPERATOR");

    /// @inheritdoc IAccessHub
    address public timelock;
    /// @inheritdoc IAccessHub
    address public treasury;

    /**
     * "nice-to-have" addresses for quickly finding contracts within the system
     */

    /// @inheritdoc IAccessHub
    address public clGaugeFactory;
    /// @inheritdoc IAccessHub
    address public gaugeFactory;
    /// @inheritdoc IAccessHub
    address public feeDistributorFactory;

    /**
     * core contracts
     */

    /// @notice central voter contract
    IVoter public voter;
    /// @notice weekly emissions minter
    IMinter public minter;
    /// @notice launchpad plugin for augmenting feeshare
    ILauncherPlugin public launcherPlugin;
    /// @notice xShadow contract
    IXShadow public xShadow;
    /// @notice X33 contract
    IX33 public x33;
    /// @notice CL V3 factory
    IShadowV3Factory public shadowV3PoolFactory;
    /// @notice legacy pair factory
    IPairFactory public poolFactory;
    /// @notice legacy fees holder contract
    IFeeRecipientFactory public feeRecipientFactory;
    /// @notice fee collector contract
    IFeeCollector public feeCollector;
    /// @notice voteModule contract
    IVoteModule public voteModule;
    /// @notice NFPManager contract
    INonfungiblePositionManager public nfpManager;

    /**
     * End of Storage Slots
     */
    modifier timelocked() {
        require(msg.sender == timelock, NOT_TIMELOCK(msg.sender));
        _;
    }

    constructor() {
        _disableInitializers();
    }

    /// @inheritdoc IAccessHub
    function initialize(InitParams calldata params) external initializer {
        /// @dev initialize all external interfaces
        timelock = params.timelock;
        treasury = params.treasury;
        voter = IVoter(params.voter);
        minter = IMinter(params.minter);
        launcherPlugin = ILauncherPlugin(params.launcherPlugin);
        xShadow = IXShadow(params.xShadow);
        x33 = IX33(params.x33);
        shadowV3PoolFactory = IShadowV3Factory(params.shadowV3PoolFactory);
        poolFactory = IPairFactory(params.poolFactory);
        feeRecipientFactory = IFeeRecipientFactory(params.feeRecipientFactory);
        feeCollector = IFeeCollector(params.feeCollector);
        voteModule = IVoteModule(params.voteModule);

        /// @dev reference addresses
        clGaugeFactory = params.clGaugeFactory;
        gaugeFactory = params.gaugeFactory;
        feeDistributorFactory = params.feeDistributorFactory;

        /// @dev fee setter role given to treasury
        _grantRole(SWAP_FEE_SETTER, params.treasury);
        /// @dev operator role given to treasury
        _grantRole(PROTOCOL_OPERATOR, params.treasury);
        /// @dev initially give admin role to treasury
        _grantRole(DEFAULT_ADMIN_ROLE, params.treasury);
        /// @dev give timelock the admin role
        _grantRole(DEFAULT_ADMIN_ROLE, params.timelock);
    }

    function reinit(InitParams calldata params) external timelocked {
        voter = IVoter(params.voter);
        minter = IMinter(params.minter);
        launcherPlugin = ILauncherPlugin(params.launcherPlugin);
        xShadow = IXShadow(params.xShadow);
        x33 = IX33(params.x33);
        shadowV3PoolFactory = IShadowV3Factory(params.shadowV3PoolFactory);
        poolFactory = IPairFactory(params.poolFactory);
        feeRecipientFactory = IFeeRecipientFactory(params.feeRecipientFactory);
        feeCollector = IFeeCollector(params.feeCollector);
        voteModule = IVoteModule(params.voteModule);

        /// @dev reference addresses
        clGaugeFactory = params.clGaugeFactory;
        gaugeFactory = params.gaugeFactory;
        feeDistributorFactory = params.feeDistributorFactory;
    }

    /// @inheritdoc IAccessHub
    function initializeVoter(
        address _shadow,
        address _legacyFactory,
        address _gauges,
        address _feeDistributorFactory,
        address _minter,
        address _msig,
        address _xShadow,
        address _clFactory,
        address _clGaugeFactory,
        address _nfpManager,
        address _feeRecipientFactory,
        address _voteModule,
        address _launcherPlugin
    ) external timelocked {
        voter.initialize(
            _shadow,
            _legacyFactory,
            _gauges,
            _feeDistributorFactory,
            _minter,
            _msig,
            _xShadow,
            _clFactory,
            _clGaugeFactory,
            _nfpManager,
            _feeRecipientFactory,
            _voteModule,
            _launcherPlugin
        );
    }

    /**
     * Fee Setting Logic
     */

    /// @inheritdoc IAccessHub
    function setSwapFees(address[] calldata _pools, uint24[] calldata _swapFees, bool[] calldata _concentrated)
        external
        onlyRole(SWAP_FEE_SETTER)
    {
        /// @dev ensure continuity of length
        require(_pools.length == _swapFees.length && _swapFees.length == _concentrated.length, IVoter.LENGTH_MISMATCH());
        for (uint256 i; i < _pools.length; ++i) {
            /// @dev we check if the pool is v3 or legacy and set their fees accordingly
            if (_concentrated[i]) {
                shadowV3PoolFactory.setFee(_pools[i], _swapFees[i]);
            } else {
                poolFactory.setPairFee(_pools[i], _swapFees[i]);
            }
        }
    }

    /// @inheritdoc IAccessHub
    function setFeeSplitCL(address[] calldata _pools, uint8[] calldata _feeProtocol)
        external
        onlyRole(SWAP_FEE_SETTER)
    {
        /// @dev ensure continuity of length
        require(_pools.length == _feeProtocol.length, IVoter.LENGTH_MISMATCH());
        for (uint256 i; i < _pools.length; ++i) {
            shadowV3PoolFactory.setPoolFeeProtocol(_pools[i], _feeProtocol[i]);
        }
    }

    /// @inheritdoc IAccessHub
    function setFeeSplitLegacy(address[] calldata _pools, uint256[] calldata _feeSplits)
        external
        onlyRole(SWAP_FEE_SETTER)
    {
        /// @dev ensure continuity of length
        require(_pools.length == _feeSplits.length, IVoter.LENGTH_MISMATCH());
        for (uint256 i; i < _pools.length; ++i) {
            poolFactory.setPairFeeSplit(_pools[i], _feeSplits[i]);
        }
    }

    /**
     * Voter governance
     */

    /// @inheritdoc IAccessHub
    function setNewGovernorInVoter(address _newGovernor) external onlyRole(PROTOCOL_OPERATOR) {
        /// @dev no checks are needed as the voter handles this already
        voter.setGovernor(_newGovernor);
    }

    /// @inheritdoc IAccessHub
    function governanceWhitelist(address[] calldata _token, bool[] calldata _whitelisted)
        external
        onlyRole(PROTOCOL_OPERATOR)
    {
        /// @dev ensure continuity of length
        require(_token.length == _whitelisted.length, IVoter.LENGTH_MISMATCH());
        for (uint256 i; i < _token.length; ++i) {
            /// @dev if adding to the whitelist
            if (_whitelisted[i]) {
                /// @dev call the voter's whitelist function
                voter.whitelist(_token[i]);
            }
            /// @dev remove the token's whitelist
            else {
                voter.revokeWhitelist(_token[i]);
            }
        }
    }

    /// @inheritdoc IAccessHub
    function killGauge(address[] calldata _pairs) external onlyRole(PROTOCOL_OPERATOR) {
        for (uint256 i; i < _pairs.length; ++i) {
            /// @dev store pair
            address pair = _pairs[i];
            /// @dev collect fees from the pair
            feeCollector.collectProtocolFees(IShadowV3Pool(pair));
            /// @dev kill the gauge
            voter.killGauge(voter.gaugeForPool(pair));
            /// @dev set the new fees in the pair to 95/5
            shadowV3PoolFactory.setPoolFeeProtocol(pair, 5);
        }
    }

    /// @inheritdoc IAccessHub
    function reviveGauge(address[] calldata _pairs) external onlyRole(PROTOCOL_OPERATOR) {
        for (uint256 i; i < _pairs.length; ++i) {
            address pair = _pairs[i];
            /// @dev collect fees from the pair
            feeCollector.collectProtocolFees(IShadowV3Pool(pair));
            /// @dev revive the pair
            voter.reviveGauge(voter.gaugeForPool(pair));
            /// @dev set fee to the factory default
            shadowV3PoolFactory.setPoolFeeProtocol(pair, shadowV3PoolFactory.feeProtocol());
        }
    }

    /// @inheritdoc IAccessHub
    function setEmissionsRatioInVoter(uint256 _pct) external onlyRole(PROTOCOL_OPERATOR) {
        voter.setGlobalRatio(_pct);
    }

    /// @inheritdoc IAccessHub
    function retrieveStuckEmissionsToGovernance(address _gauge, uint256 _period) external onlyRole(PROTOCOL_OPERATOR) {
        voter.stuckEmissionsRecovery(_gauge, _period);
    }

    /// @inheritdoc IAccessHub
    function setMainTickSpacingInVoter(address tokenA, address tokenB, int24 tickSpacing)
        external
        onlyRole(PROTOCOL_OPERATOR)
    {
        voter.setMainTickSpacing(tokenA, tokenB, tickSpacing);
    }

    function createGaugeForPool(address _pool) external onlyRole(PROTOCOL_OPERATOR) {
        bool isCl = shadowV3PoolFactory.isPairV3(_pool);
        if (isCl) {
            IShadowV3Pool poolv3 = IShadowV3Pool(_pool);
            (address token0, address token1, int24 tickSpacing) =
                (poolv3.token0(), poolv3.token1(), poolv3.tickSpacing());
            voter.createCLGauge(token0, token1, tickSpacing);
        } else {
            voter.createGauge(_pool);
        }
    }

    /// @inheritdoc IAccessHub
    function resetVotesOnBehalfOf(address _user) external timelocked {
        voter.reset(_user);
    }

    /**
     * xShadow Functions
     */

    /// @inheritdoc IAccessHub
    function transferWhitelistInXShadow(address[] calldata _who, bool[] calldata _whitelisted)
        external
        onlyRole(PROTOCOL_OPERATOR)
    {
        /// @dev ensure continuity of length
        require(_who.length == _whitelisted.length, IVoter.LENGTH_MISMATCH());
        xShadow.setExemption(_who, _whitelisted);
    }

    /// @inheritdoc IAccessHub
    function transferToWhitelistInXShadow(address[] calldata _who, bool[] calldata _whitelisted)
        external
        onlyRole(PROTOCOL_OPERATOR)
    {
        /// @dev ensure continuity of length
        require(_who.length == _whitelisted.length, IVoter.LENGTH_MISMATCH());
        xShadow.setExemptionTo(_who, _whitelisted);
    }

    /// @inheritdoc IAccessHub
    function toggleXShadowGovernance(bool enable) external onlyRole(PROTOCOL_OPERATOR) {
        /// @dev if enabled we call unpause otherwise we pause to disable
        enable ? xShadow.unpause() : xShadow.pause();
    }

    /// @inheritdoc IAccessHub
    function operatorRedeemXShadow(uint256 _amount) external onlyRole(PROTOCOL_OPERATOR) {
        xShadow.operatorRedeem(_amount);
    }

    /// @inheritdoc IAccessHub
    function migrateOperator(address _operator) external onlyRole(PROTOCOL_OPERATOR) {
        xShadow.migrateOperator(_operator);
    }

    /// @inheritdoc IAccessHub
    function rescueTrappedTokens(address[] calldata _tokens, uint256[] calldata _amounts)
        external
        onlyRole(PROTOCOL_OPERATOR)
    {
        xShadow.rescueTrappedTokens(_tokens, _amounts);
    }

    /**
     * X33 Functions
     */

    /// @inheritdoc IAccessHub
    function transferOperatorInX33(address _newOperator) external onlyRole(PROTOCOL_OPERATOR) {
        x33.transferOperator(_newOperator);
    }

    /**
     * Minter Functions
     */

    /// @inheritdoc IAccessHub
    function setEmissionsMultiplierInMinter(uint256 _multiplier) external onlyRole(PROTOCOL_OPERATOR) {
        minter.updateEmissionsMultiplier(_multiplier);
    }

    /**
     * Reward List Functions
     */

    /// @inheritdoc IAccessHub
    function augmentGaugeRewardsForPair(
        address[] calldata _pools,
        address[] calldata _rewards,
        bool[] calldata _addReward
    ) external onlyRole(PROTOCOL_OPERATOR) {
        /// @dev length continuity check
        require(_pools.length == _rewards.length && _rewards.length == _addReward.length, IVoter.LENGTH_MISMATCH());
        /// @dev loop through all entries
        for (uint256 i; i < _pools.length; ++i) {
            /// @dev fetch the gauge address
            address gauge = voter.gaugeForPool(_pools[i]);
            /// @dev if true (add rewards)
            if (_addReward[i]) {
                voter.whitelistGaugeRewards(gauge, _rewards[i]);
            }
            /// @dev if false remove the rewards
            else {
                voter.removeGaugeRewardWhitelist(gauge, _rewards[i]);
            }
        }
    }
    /// @inheritdoc IAccessHub

    function removeFeeDistributorRewards(address[] calldata _pools, address[] calldata _rewards)
        external
        onlyRole(PROTOCOL_OPERATOR)
    {
        require(_pools.length == _rewards.length, IVoter.LENGTH_MISMATCH());
        for (uint256 i; i < _pools.length; ++i) {
            voter.removeFeeDistributorReward(voter.feeDistributorForGauge(voter.gaugeForPool(_pools[i])), _rewards[i]);
        }
    }

    /**
     * LauncherPlugin specific functions
     */

    /// @inheritdoc IAccessHub
    function migratePoolInLauncherPlugin(address _oldPool, address _newPool) external onlyRole(PROTOCOL_OPERATOR) {
        launcherPlugin.migratePool(_oldPool, _newPool);
    }

    /// @inheritdoc IAccessHub
    function setConfigsInLauncherPlugin(address _pool, uint256 _take, address _recipient)
        external
        onlyRole(PROTOCOL_OPERATOR)
    {
        launcherPlugin.setConfigs(_pool, _take, _recipient);
    }

    /// @inheritdoc IAccessHub
    function enablePoolInLauncherPlugin(address _pool) external onlyRole(PROTOCOL_OPERATOR) {
        launcherPlugin.enablePool(_pool);
    }

    /// @inheritdoc IAccessHub
    function disablePoolInLauncherPlugin(address _pool) external onlyRole(PROTOCOL_OPERATOR) {
        launcherPlugin.disablePool(_pool);
    }

    /// @inheritdoc IAccessHub
    function setOperatorInLauncherPlugin(address _newOperator) external onlyRole(PROTOCOL_OPERATOR) {
        launcherPlugin.setOperator(_newOperator);
    }

    /// @inheritdoc IAccessHub
    function grantAuthorityInLauncherPlugin(address _newAuthority, string calldata _label)
        external
        onlyRole(PROTOCOL_OPERATOR)
    {
        launcherPlugin.grantAuthority(_newAuthority, _label);
    }

    /// @inheritdoc IAccessHub
    function labelAuthorityInLauncherPlugin(address _authority, string calldata _label)
        external
        onlyRole(PROTOCOL_OPERATOR)
    {
        launcherPlugin.label(_authority, _label);
    }

    /// @inheritdoc IAccessHub
    function revokeAuthorityInLauncherPlugin(address _oldAuthority) external onlyRole(PROTOCOL_OPERATOR) {
        launcherPlugin.revokeAuthority(_oldAuthority);
    }

    /**
     * FeeCollector functions
     */

    /// @inheritdoc IAccessHub
    function setTreasuryInFeeCollector(address newTreasury) external onlyRole(PROTOCOL_OPERATOR) {
        feeCollector.setTreasury(newTreasury);
    }

    /// @inheritdoc IAccessHub
    function setTreasuryFeesInFeeCollector(uint256 _treasuryFees) external onlyRole(PROTOCOL_OPERATOR) {
        feeCollector.setTreasuryFees(_treasuryFees);
    }

    /**
     * FeeRecipientFactory functions
     */

    /// @inheritdoc IAccessHub
    function setFeeToTreasuryInFeeRecipientFactory(uint256 _feeToTreasury) external onlyRole(PROTOCOL_OPERATOR) {
        feeRecipientFactory.setFeeToTreasury(_feeToTreasury);
    }

    /// @inheritdoc IAccessHub
    function setTreasuryInFeeRecipientFactory(address _treasury) external onlyRole(PROTOCOL_OPERATOR) {
        feeRecipientFactory.setTreasury(_treasury);
    }

    /**
     * CL Pool Factory functions
     */

    /// @inheritdoc IAccessHub
    function enableTickSpacing(int24 tickSpacing, uint24 initialFee) external onlyRole(PROTOCOL_OPERATOR) {
        shadowV3PoolFactory.enableTickSpacing(tickSpacing, initialFee);
    }

    /// @inheritdoc IAccessHub
    function setGlobalClFeeProtocol(uint8 _feeProtocolGlobal) external onlyRole(PROTOCOL_OPERATOR) {
        shadowV3PoolFactory.setFeeProtocol(_feeProtocolGlobal);
    }

    /// @inheritdoc IAccessHub
    /// @notice sets the address of the voter in the v3 factory for gauge fee setting
    function setVoterAddressInFactoryV3(address _voter) external timelocked {
        shadowV3PoolFactory.setVoter(_voter);
    }

    /// @inheritdoc IAccessHub
    function setFeeCollectorInFactoryV3(address _newFeeCollector) external timelocked {
        shadowV3PoolFactory.setFeeCollector(_newFeeCollector);
    }

    /**
     * Legacy Pool Factory functions
     */

    /// @inheritdoc IAccessHub
    function setTreasuryInLegacyFactory(address _treasury) external onlyRole(PROTOCOL_OPERATOR) {
        poolFactory.setTreasury(_treasury);
    }

    /// @inheritdoc IAccessHub
    function setFeeSplitWhenNoGauge(bool status) external onlyRole(PROTOCOL_OPERATOR) {
        poolFactory.setFeeSplitWhenNoGauge(status);
    }

    /// @inheritdoc IAccessHub
    function setLegacyFeeSplitGlobal(uint256 _feeSplit) external onlyRole(PROTOCOL_OPERATOR) {
        poolFactory.setFeeSplit(_feeSplit);
    }

    /// @inheritdoc IAccessHub
    function setLegacyFeeGlobal(uint256 _fee) external onlyRole(PROTOCOL_OPERATOR) {
        poolFactory.setFee(_fee);
    }

    /// @inheritdoc IAccessHub
    function setSkimEnabledLegacy(address _pair, bool _status) external onlyRole(PROTOCOL_OPERATOR) {
        poolFactory.setSkimEnabled(_pair, _status);
    }

    /**
     * VoteModule Functions
     */

    /// @inheritdoc IAccessHub
    function setCooldownExemption(address[] calldata _candidates, bool[] calldata _exempt) external timelocked {
        for (uint256 i; i < _candidates.length; ++i) {
            voteModule.setCooldownExemption(_candidates[i], _exempt[i]);
        }
    }

    /// @inheritdoc IAccessHub
    function setNewRebaseStreamingDuration(uint256 _newDuration) external timelocked {
        voteModule.setNewDuration(_newDuration);
    }

    /// @inheritdoc IAccessHub
    function setNewVoteModuleCooldown(uint256 _newCooldown) external timelocked {
        voteModule.setNewCooldown(_newCooldown);
    }

    /// @inheritdoc IAccessHub
    function kickInactive(address[] calldata _nonparticipants) external onlyRole(PROTOCOL_OPERATOR) {
        IVoter voterContract = IVoter(voter);
        uint256 nextPeriod = voterContract.getPeriod() + 1;

        /// @dev loop through all input addresses to check status of vote
        for (uint256 i; i < _nonparticipants.length; ++i) {
            /// @dev store for use
            address nonparticipant = _nonparticipants[i];
            /// @dev fetch data on current voting period (nextPeriod votes)
            (address[] memory _pools, uint256[] memory _weights) = voterContract.getVotes(nonparticipant, nextPeriod);

            /// @dev require the user has not voted this epoch
            require(_pools.length == 0 && _weights.length == 0, KICK_FORBIDDEN(nonparticipant));
            /// @dev reset the user's votes
            voterContract.reset(nonparticipant);
        }
    }

    /**
     * Timelock specific functions
     */

    /// @inheritdoc IAccessHub
    function execute(address _target, bytes calldata _payload) external timelocked {
        (bool success,) = _target.call(_payload);
        require(success, MANUAL_EXECUTION_FAILURE(_payload));
    }

    /// @inheritdoc IAccessHub
    function setNewTimelock(address _timelock) external timelocked {
        require(timelock != _timelock, SAME_ADDRESS());
        timelock = _timelock;
    }

    /// backup distribute method
    function backupDistribute() external onlyRole(PROTOCOL_OPERATOR) {
        backupDistributeBatch(0, type(uint256).max);
    }

    function backupDistributeBatch(uint256 startIndex, uint256 batchSize) public onlyRole(PROTOCOL_OPERATOR) {
        address SHADOW = address(xShadow.SHADOW());

        if (!Pausable(address(xShadow)).paused()) {
            xShadow.pause();
        }
        minter.updatePeriod();

        uint256 currentPeriod = voter.getPeriod();
        address[] memory gauges = voter.getAllGauges();
        uint256 totalRewardPerPeriod = voter.totalRewardPerPeriod(currentPeriod);
        uint256 totalVotesPerPeriod = voter.totalVotesPerPeriod(currentPeriod);

        uint256 endIndex = startIndex + batchSize;
        if (endIndex > gauges.length) {
            endIndex = gauges.length;
        }

        for (uint256 i = startIndex; i < endIndex; i++) {
            uint256 lastDistro = voter.lastDistro(gauges[i]);
            if (lastDistro == currentPeriod) {
                continue;
            }

            uint256 balanceInVoter = IERC20(SHADOW).balanceOf(address(voter));
            address pool = voter.poolForGauge(gauges[i]);
            uint256 poolVotes = voter.poolTotalVotesPerPeriod(pool, currentPeriod);
            uint256 numerator = totalRewardPerPeriod * poolVotes * 1e18;
            uint256 balanceNeeded = numerator == 0 ? 0 : numerator / totalVotesPerPeriod / 1e18;

            if (balanceNeeded > balanceInVoter) {
                IERC20(SHADOW).transfer(address(voter), balanceNeeded - balanceInVoter);
            }

            if (voter.isAlive(gauges[i])) {
                voter.killGauge(gauges[i]);
                voter.reviveGauge(gauges[i]);
            } else {
                voter.stuckEmissionsRecovery(gauges[i], currentPeriod);
            }
        }
    }
    /// @dev allow distributing emissions via the accessHub

    function notifyEmissions(address[] calldata pools, uint256[] calldata emissions)
        external
        onlyRole(PROTOCOL_OPERATOR)
    {
        IERC20 SHADOW = IERC20(xShadow.SHADOW());
        SHADOW.approve(address(xShadow), SHADOW.balanceOf(address(this)));
        xShadow.convertEmissionsToken(SHADOW.balanceOf(address(this)));
        for (uint256 i; i < pools.length; ++i) {
            address pool = pools[i];
            address gauge = voter.gaugeForPool(pool);
            uint256 amount = emissions[i];
            xShadow.approve(gauge, amount);
            /// @dev both CL and legacy gauges have the same function so we can reuse the interface regardless
            IGaugeV3(gauge).notifyRewardAmount(address(xShadow), amount);
        }
    }

    function rescue(address token) external onlyRole(PROTOCOL_OPERATOR) {
        IERC20(token).transfer(treasury, IERC20(token).balanceOf(address(this)));
    }

    function rescueFromX33(address _token, uint256 _amount) external onlyRole(PROTOCOL_OPERATOR) {
        x33.rescue(_token, _amount);
    }
}

File 2 of 42 : IAccessHub.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.x;

import {IVoteModule} from "contracts/interfaces/IVoteModule.sol";
import {IVoter} from "contracts/interfaces/IVoter.sol";

interface IAccessHub {
    error SAME_ADDRESS();
    error NOT_TIMELOCK(address);
    error MANUAL_EXECUTION_FAILURE(bytes);
    error KICK_FORBIDDEN(address);

    /// @dev Struct to hold initialization parameters
    struct InitParams {
        address timelock;
        address treasury;
        address voter;
        address minter;
        address launcherPlugin;
        address xShadow;
        address x33;
        address shadowV3PoolFactory;
        address poolFactory;
        address clGaugeFactory;
        address gaugeFactory;
        address feeRecipientFactory;
        address feeDistributorFactory;
        address feeCollector;
        address voteModule;
    }

    /// @notice protocol timelock address
    function timelock() external view returns (address timelock);

    /// @notice protocol treasury address
    function treasury() external view returns (address treasury);

    /// @notice vote module
    function voteModule() external view returns (IVoteModule voteModule);

    /// @notice voter
    function voter() external view returns (IVoter voter);

    /// @notice concentrated (v3) gauge factory
    function clGaugeFactory() external view returns (address _clGaugeFactory);

    /// @notice legacy gauge factory address
    function gaugeFactory() external view returns (address _gaugeFactory);

    /// @notice the feeDistributor factory address
    function feeDistributorFactory() external view returns (address _feeDistributorFactory);

    /// @notice initializing function for setting values in the AccessHub
    function initialize(InitParams calldata params) external;

    /// @notice sets the swap fees for multiple pairs
    function setSwapFees(address[] calldata _pools, uint24[] calldata _swapFees, bool[] calldata _concentrated)
        external;

    /// @notice sets the split of fees between LPs and voters
    function setFeeSplitCL(address[] calldata _pools, uint8[] calldata _feeProtocol) external;

    /// @notice sets the split of fees between LPs and voters for legacy pools
    function setFeeSplitLegacy(address[] calldata _pools, uint256[] calldata _feeSplits) external;

    /**
     * Voter governance
     */

    /// @notice sets a new governor address in the voter.sol contract
    function setNewGovernorInVoter(address _newGovernor) external;

    /// @notice whitelists a token for governance, or removes if boolean is set to false
    function governanceWhitelist(address[] calldata _token, bool[] calldata _whitelisted) external;

    /// @notice kills active gauges, removing them from earning further emissions, and claims their fees prior
    function killGauge(address[] calldata _pairs) external;

    /// @notice revives inactive/killed gauges
    function reviveGauge(address[] calldata _pairs) external;

    /// @notice sets the ratio of xShadow/Shadow awarded globally to LPs
    function setEmissionsRatioInVoter(uint256 _pct) external;

    /// @notice allows governance to retrieve emissions in the voter contract that will not be distributed due to the gauge being inactive
    /// @dev allows per-period retrieval for granularity
    function retrieveStuckEmissionsToGovernance(address _gauge, uint256 _period) external;

    /// @notice allows governance to designate a tickspacing as the "main" one, to prevent governance spam and confusion
    function setMainTickSpacingInVoter(address tokenA, address tokenB, int24 tickSpacing) external;
    function createGaugeForPool(address _pool) external;
    function resetVotesOnBehalfOf(address _user) external;

    /**
     * xShadow Functions
     */

    /// @notice enables or disables the transfer whitelist in xShadow
    function transferWhitelistInXShadow(address[] calldata _who, bool[] calldata _whitelisted) external;

    /// @notice enables or disables the transfer TO whitelists in xShadow
    function transferToWhitelistInXShadow(address[] calldata _who, bool[] calldata _whitelisted) external;

    /// @notice enables or disables the governance in xShadow
    function toggleXShadowGovernance(bool enable) external;

    /// @notice allows redemption from the operator
    function operatorRedeemXShadow(uint256 _amount) external;

    /// @notice migrates the xShadow operator
    function migrateOperator(address _operator) external;

    /// @notice rescues any trapped tokens in xShadow
    function rescueTrappedTokens(address[] calldata _tokens, uint256[] calldata _amounts) external;

    /**
     * X33 Functions
     */

    /// @notice transfers the x33 operator address
    function transferOperatorInX33(address _newOperator) external;

    /**
     * Minter Functions
     */

    /// @notice sets the inflation multiplier
    /// @param _multiplier the multiplier
    function setEmissionsMultiplierInMinter(uint256 _multiplier) external;

    /**
     * Reward List Functions
     */

    /// @notice function for adding or removing rewards for pools
    function augmentGaugeRewardsForPair(
        address[] calldata _pools,
        address[] calldata _rewards,
        bool[] calldata _addReward
    ) external;
    /// @notice function for removing rewards for feeDistributors
    function removeFeeDistributorRewards(address[] calldata _pools, address[] calldata _rewards) external;

    /**
     * LauncherPlugin specific functions
     */

    /// @notice allows migrating the parameters from one pool to the other
    /// @param _oldPool the current address of the pair
    /// @param _newPool the new pool's address
    function migratePoolInLauncherPlugin(address _oldPool, address _newPool) external;

    /// @notice set launcher configurations for a pool
    /// @param _pool address of the pool
    /// @param _take the fee that goes to the designated recipient
    /// @param _recipient the address that receives the fees
    function setConfigsInLauncherPlugin(address _pool, uint256 _take, address _recipient) external;

    /// @notice enables the pool for LauncherConfigs
    /// @param _pool address of the pool
    function enablePoolInLauncherPlugin(address _pool) external;

    /// @notice disables the pool for LauncherConfigs
    /// @dev clears mappings
    /// @param _pool address of the pool
    function disablePoolInLauncherPlugin(address _pool) external;

    /// @notice sets a new operator address
    /// @param _newOperator new operator address
    function setOperatorInLauncherPlugin(address _newOperator) external;

    /// @notice gives authority to a new contract/address
    /// @param _newAuthority the suggested new authority
    function grantAuthorityInLauncherPlugin(address _newAuthority, string calldata _label) external;

    /// @notice governance ability to label each authority in the system with an arbitrary string
    function labelAuthorityInLauncherPlugin(address _authority, string calldata _label) external;

    /// @notice removes authority from a contract/address
    /// @param _oldAuthority the to-be-removed authority
    function revokeAuthorityInLauncherPlugin(address _oldAuthority) external;

    /**
     * FeeCollector functions
     */

    /// @notice Sets the treasury address to a new value.
    /// @param newTreasury The new address to set as the treasury.
    function setTreasuryInFeeCollector(address newTreasury) external;

    /// @notice Sets the value of treasury fees to a new amount.
    /// @param _treasuryFees The new amount of treasury fees to be set.
    function setTreasuryFeesInFeeCollector(uint256 _treasuryFees) external;

    /**
     * FeeRecipientFactory functions
     */

    /// @notice set the fee % to be sent to the treasury
    /// @param _feeToTreasury the fee % to be sent to the treasury
    function setFeeToTreasuryInFeeRecipientFactory(uint256 _feeToTreasury) external;

    /// @notice set a new treasury address
    /// @param _treasury the new address
    function setTreasuryInFeeRecipientFactory(address _treasury) external;

    /**
     * CL Pool Factory functions
     */

    /// @notice enables a tickSpacing with the given initialFee amount
    /// @dev unlike UniswapV3, we map via the tickSpacing rather than the fee tier
    /// @dev tickSpacings may never be removed once enabled
    /// @param tickSpacing The spacing between ticks to be enforced for all pools created
    /// @param initialFee The initial fee amount, denominated in hundredths of a bip (i.e. 1e-6)
    function enableTickSpacing(int24 tickSpacing, uint24 initialFee) external;

    /// @notice sets the feeProtocol (feeSplit) for new CL pools and stored in the factory
    function setGlobalClFeeProtocol(uint8 _feeProtocolGlobal) external;

    /// @notice sets the address of the voter in the v3 factory for gauge fee setting
    function setVoterAddressInFactoryV3(address _voter) external;

    /// @notice sets the address of the feeCollector in the v3 factory for fee routing
    function setFeeCollectorInFactoryV3(address _newFeeCollector) external;

    /**
     * Legacy Pool Factory functions
     */

    /// @notice sets the treasury address in the legacy factory
    function setTreasuryInLegacyFactory(address _treasury) external;

    /// @notice enables or disables if there is a feeSplit when no gauge for legacy pairs
    function setFeeSplitWhenNoGauge(bool status) external;

    /// @notice set the default feeSplit in the legacy factory
    function setLegacyFeeSplitGlobal(uint256 _feeSplit) external;

    /// @notice set the default swap fee for legacy pools
    function setLegacyFeeGlobal(uint256 _fee) external;

    /// @notice sets whether a pair can have skim() called or not for rebasing purposes
    function setSkimEnabledLegacy(address _pair, bool _status) external;

    /**
     * VoteModule Functions
     */

    /// @notice sets addresses as exempt or removes their exemption
    function setCooldownExemption(address[] calldata _candidates, bool[] calldata _exempt) external;

    /// @notice function to alter the duration that rebases are streamed in the voteModule
    function setNewRebaseStreamingDuration(uint256 _newDuration) external;

    /// @notice function to change the cooldown in the voteModule
    function setNewVoteModuleCooldown(uint256 _newCooldown) external;

    /// @notice allows resetting of inactive votes to prevent dead votes
    function kickInactive(address[] calldata _nonparticipants) external;

    /**
     * Timelock gated functions
     */

    /// @notice timelock gated payload execution in case tokens get stuck or other unexpected behaviors
    function execute(address _target, bytes calldata _payload) external;

    /// @notice timelock gated function to change the timelock
    function setNewTimelock(address _timelock) external;

    /// @notice function for initializing the voter contract with its dependencies
    function initializeVoter(
        address _shadow,
        address _legacyFactory,
        address _gauges,
        address _feeDistributorFactory,
        address _minter,
        address _msig,
        address _xShadow,
        address _clFactory,
        address _clGaugeFactory,
        address _nfpManager,
        address _feeRecipientFactory,
        address _voteModule,
        address _launcherPlugin
    ) external;

    function backupDistribute() external;
    function backupDistributeBatch(uint256 startIndex, uint256 batchSize) external;
}

File 3 of 42 : AccessControlEnumerableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (access/extensions/AccessControlEnumerable.sol)

pragma solidity ^0.8.20;

import {IAccessControlEnumerable} from "@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol";
import {AccessControlUpgradeable} from "../AccessControlUpgradeable.sol";
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import {Initializable} from "../../proxy/utils/Initializable.sol";

/**
 * @dev Extension of {AccessControl} that allows enumerating the members of each role.
 */
abstract contract AccessControlEnumerableUpgradeable is Initializable, IAccessControlEnumerable, AccessControlUpgradeable {
    using EnumerableSet for EnumerableSet.AddressSet;

    /// @custom:storage-location erc7201:openzeppelin.storage.AccessControlEnumerable
    struct AccessControlEnumerableStorage {
        mapping(bytes32 role => EnumerableSet.AddressSet) _roleMembers;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.AccessControlEnumerable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant AccessControlEnumerableStorageLocation = 0xc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e82371705932000;

    function _getAccessControlEnumerableStorage() private pure returns (AccessControlEnumerableStorage storage $) {
        assembly {
            $.slot := AccessControlEnumerableStorageLocation
        }
    }

    function __AccessControlEnumerable_init() internal onlyInitializing {
    }

    function __AccessControlEnumerable_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {
        AccessControlEnumerableStorage storage $ = _getAccessControlEnumerableStorage();
        return $._roleMembers[role].at(index);
    }

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {
        AccessControlEnumerableStorage storage $ = _getAccessControlEnumerableStorage();
        return $._roleMembers[role].length();
    }

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

    /**
     * @dev Overload {AccessControl-_grantRole} to track enumerable memberships
     */
    function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {
        AccessControlEnumerableStorage storage $ = _getAccessControlEnumerableStorage();
        bool granted = super._grantRole(role, account);
        if (granted) {
            $._roleMembers[role].add(account);
        }
        return granted;
    }

    /**
     * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships
     */
    function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {
        AccessControlEnumerableStorage storage $ = _getAccessControlEnumerableStorage();
        bool revoked = super._revokeRole(role, account);
        if (revoked) {
            $._roleMembers[role].remove(account);
        }
        return revoked;
    }
}

File 4 of 42 : ILauncherPlugin.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.x;

interface ILauncherPlugin {
    error NOT_AUTHORITY();
    error ALREADY_AUTHORITY();
    error NOT_OPERATOR();
    error ALREADY_OPERATOR();
    error NOT_ENABLED(address pool);
    error NO_FEEDIST();
    error ENABLED();
    error INVALID_TAKE();

    /// @dev struct that holds the configurations of each specific pool
    struct LauncherConfigs {
        uint256 launcherTake;
        address takeRecipient;
    }

    event NewOperator(address indexed _old, address indexed _new);

    event NewAuthority(address indexed _newAuthority);
    event RemovedAuthority(address indexed _previousAuthority);

    event EnabledPool(address indexed pool, string indexed _name);
    event DisabledPool(address indexed pool);
    event MigratedPool(address indexed oldPool, address indexed newPool);
    event Configured(
        address indexed pool,
        uint256 take,
        address indexed recipient
    );

    event Labeled(address indexed authority, string indexed label);

    /// @notice address of the accessHub
    function accessHub() external view returns (address _accessHub);
    /// @notice protocol operator address
    function operator() external view returns (address _operator);

    /// @notice the denominator constant
    function DENOM() external view returns (uint256 _denominator);

    /// @notice whether configs are enabled for a pool
    /// @param _pool address of the pool
    /// @return bool
    function launcherPluginEnabled(address _pool) external view returns (bool);

    /// @notice maps whether an address is an authority or not
    /// @param _who the address to check
    /// @return _is true or false
    function authorityMap(address _who) external view returns (bool _is);

    /// @notice allows migrating the parameters from one pool to the other
    /// @param _oldPool the current address of the pair
    /// @param _newPool the new pool's address
    function migratePool(address _oldPool, address _newPool) external;

    /// @notice fetch the launcher configs if any
    /// @param _pool address of the pool
    /// @return LauncherConfigs the configs
    function poolConfigs(
        address _pool
    ) external view returns (uint256, address);
    /// @notice view functionality to see who is an authority
    function nameOfAuthority(address) external view returns (string memory);

    /// @notice returns the pool address for a feeDist
    /// @param _feeDist address of the feeDist
    /// @return _pool the pool address from the mapping
    function feeDistToPool(
        address _feeDist
    ) external view returns (address _pool);

    /// @notice set launcher configurations for a pool
    /// @param _pool address of the pool
    /// @param _take the fee that goes to the designated recipient
    /// @param _recipient the address that receives the fees
    function setConfigs(
        address _pool,
        uint256 _take,
        address _recipient
    ) external;

    /// @notice enables the pool for LauncherConfigs
    /// @param _pool address of the pool
    function enablePool(address _pool) external;

    /// @notice disables the pool for LauncherConfigs
    /// @dev clears mappings
    /// @param _pool address of the pool
    function disablePool(address _pool) external;

    /// @notice sets a new operator address
    /// @param _newOperator new operator address
    function setOperator(address _newOperator) external;

    /// @notice gives authority to a new contract/address
    /// @param _newAuthority the suggested new authority
    function grantAuthority(address _newAuthority, string calldata) external;

    /// @notice removes authority from a contract/address
    /// @param _oldAuthority the to-be-removed authority
    function revokeAuthority(address _oldAuthority) external;

    /// @notice labels an authority
    function label(address, string calldata) external;

    /// @notice returns the values for the launcherConfig of the specific feeDist
    /// @param _feeDist the address of the feeDist
    /// @return _launcherTake fee amount taken
    /// @return _recipient address that receives the fees
    function values(
        address _feeDist
    ) external view returns (uint256 _launcherTake, address _recipient);
}

File 5 of 42 : IXShadow.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.x;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IVoter} from "./IVoter.sol";
import {Pausable} from "@openzeppelin/contracts/utils/Pausable.sol";

interface IXShadow is IERC20 {
    struct VestPosition {
        /// @dev amount of xShadow
        uint256 amount;
        /// @dev start unix timestamp
        uint256 start;
        /// @dev start + MAX_VEST (end timestamp)
        uint256 maxEnd;
        /// @dev vest identifier (starting from 0)
        uint256 vestID;
    }

    error NOT_WHITELISTED(address);
    error NOT_MINTER();
    error ZERO();
    error NO_VEST();
    error ALREADY_EXEMPT();
    error NOT_EXEMPT();
    error CANT_RESCUE();
    error NO_CHANGE();
    error ARRAY_LENGTHS();
    error TOO_HIGH();
    error VEST_OVERLAP();

    event CancelVesting(
        address indexed user,
        uint256 indexed vestId,
        uint256 amount
    );
    event ExitVesting(
        address indexed user,
        uint256 indexed vestId,
        uint256 amount
    );
    event InstantExit(address indexed user, uint256);

    event NewSlashingPenalty(uint256 penalty);

    event NewVest(
        address indexed user,
        uint256 indexed vestId,
        uint256 indexed amount
    );
    event NewVestingTimes(uint256 min, uint256 max);

    event Converted(address indexed user, uint256);

    event Exemption(address indexed candidate, bool status, bool success);

    event XShadowRedeemed(address indexed user, uint256);

    event NewOperator(address indexed o, address indexed n);

    event Rebase(address indexed caller, uint256 amount);

    /// @notice returns info on a user's vests
    function vestInfo(
        address user,
        uint256
    )
        external
        view
        returns (uint256 amount, uint256 start, uint256 maxEnd, uint256 vestID);

    /// @notice address of the shadow token
    function SHADOW() external view returns (IERC20);

    /// @notice address of the voter
    function VOTER() external view returns (IVoter);

    function MINTER() external view returns (address);

    function ACCESS_HUB() external view returns (address);

    /// @notice address of the operator
    function operator() external view returns (address);

    /// @notice address of the VoteModule
    function VOTE_MODULE() external view returns (address);

    /// @notice max slashing amount
    function SLASHING_PENALTY() external view returns (uint256);

    /// @notice denominator
    function BASIS() external view returns (uint256);

    /// @notice the minimum vesting length
    function MIN_VEST() external view returns (uint256);

    /// @notice the maximum vesting length
    function MAX_VEST() external view returns (uint256);

    function shadow() external view returns (address);

    /// @notice the last period rebases were distributed
    function lastDistributedPeriod() external view returns (uint256);

    /// @notice amount of pvp rebase penalties accumulated pending to be distributed
    function pendingRebase() external view returns (uint256);

    /// @notice pauses the contract
    function pause() external;

    /// @notice unpauses the contract
    function unpause() external;

    /*****************************************************************/
    // General use functions
    /*****************************************************************/

    /// @dev mints xShadows for each shadow.
    function convertEmissionsToken(uint256 _amount) external;

    /// @notice function called by the minter to send the rebases once a week
    function rebase() external;
    /**
     * @dev exit instantly with a penalty
     * @param _amount amount of xShadows to exit
     */
    function exit(uint256 _amount) external returns(uint256 _exitedAmount);

    /// @dev vesting xShadows --> emissionToken functionality
    function createVest(uint256 _amount) external;

    /// @dev handles all situations regarding exiting vests
    function exitVest(uint256 _vestID) external;

    /*****************************************************************/
    // Permissioned functions, timelock/operator gated
    /*****************************************************************/

    /// @dev allows the operator to redeem collected xShadows
    function operatorRedeem(uint256 _amount) external;

    /// @dev allows rescue of any non-stake token
    function rescueTrappedTokens(
        address[] calldata _tokens,
        uint256[] calldata _amounts
    ) external;

    /// @notice migrates the operator to another contract
    function migrateOperator(address _operator) external;

    /// @notice set exemption status for an address
    function setExemption(
        address[] calldata _exemptee,
        bool[] calldata _exempt
    ) external;

    function setExemptionTo(
        address[] calldata _exemptee,
        bool[] calldata _exempt
    ) external;

    /*****************************************************************/
    // Getter functions
    /*****************************************************************/

    /// @notice returns the amount of SHADOW within the contract
    function getBalanceResiding() external view returns (uint256);
    /// @notice returns the total number of individual vests the user has
    function usersTotalVests(
        address _who
    ) external view returns (uint256 _numOfVests);

    /// @notice whether the address is exempt
    /// @param _who who to check
    /// @return _exempt whether it's exempt
    function isExempt(address _who) external view returns (bool _exempt);

    /// @notice returns the vest info for a user
    /// @param _who who to check
    /// @param _vestID vest ID to check
    /// @return VestPosition vest info
    function getVestInfo(
        address _who,
        uint256 _vestID
    ) external view returns (VestPosition memory);
}

File 6 of 42 : IX33.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.x;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IXShadow} from "contracts/interfaces/IXShadow.sol";

interface IX33 is IERC20 {
    /// @dev parameters passed to the aggregator swap
    struct AggregatorParams {
        address aggregator; // address of the whitelisted aggregator
        address tokenIn; // token to swap from
        uint256 amountIn; // amount of tokenIn to swap
        uint256 minAmountOut; // minimum amount of tokenOut to receive
        bytes callData; // encoded swap calldata
    }

    /**
     * Error strings
     */
    error ZERO();
    error NOT_ENOUGH();
    error NOT_CONFORMED_TO_SCALE(uint256);
    error NOT_ACCESSHUB(address);
    error LOCKED();
    error REBASE_IN_PROGRESS();
    error AGGREGATOR_REVERTED(bytes);
    error AMOUNT_OUT_TOO_LOW(uint256);
    error AGGREGATOR_NOT_WHITELISTED(address);
    error FORBIDDEN_TOKEN(address);

    event Entered(address indexed user, uint256 amount, uint256 ratioAtDeposit);
    event Exited(address indexed user, uint256 _outAmount, uint256 ratioAtWithdrawal);

    event NewOperator(address _oldOperator, address _newOperator);
    event Compounded(uint256 oldRatio, uint256 newRatio, uint256 amount);
    event SwappedBribe(address indexed operator, address indexed tokenIn, uint256 amountIn, uint256 amountOut);
    event Rebased(uint256 oldRatio, uint256 newRatio, uint256 amount);
    /// @notice Event emitted when an aggregator's whitelist status changes
    event AggregatorWhitelistUpdated(address aggregator, bool status);

    event Unlocked(uint256 _ts);

    event UpdatedIndex(uint256 _index);

    event ClaimedIncentives(address[] feeDistributors, address[][] tokens);

    /// @notice submits the optimized votes for the epoch
    function submitVotes(address[] calldata _pools, uint256[] calldata _weights) external;

    /// @notice swap function using aggregators to process rewards into SHADOW
    function swapIncentiveViaAggregator(AggregatorParams calldata _params) external;

    /// @notice claims the rebase accrued to x33
    function claimRebase() external;

    /// @notice compounds any existing SHADOW within the contract
    function compound() external;

    /// @notice direct claim
    function claimIncentives(address[] calldata _feeDistributors, address[][] calldata _tokens) external;

    /// @notice rescue stuck tokens
    function rescue(address _token, uint256 _amount) external;

    /// @notice allows the operator to unlock the contract for the current period
    function unlock() external;

    /// @notice add or remove an aggregator from the whitelist (timelocked)
    /// @param _aggregator address of the aggregator to update
    /// @param _status new whitelist status
    function whitelistAggregator(address _aggregator, bool _status) external;

    /// @notice transfers the operator via accesshub
    function transferOperator(address _newOperator) external;

    /// @notice simple getPeriod call
    function getPeriod() external view returns (uint256 period);

    /// @notice if the contract is unlocked for deposits
    function isUnlocked() external view returns (bool);

    /// @notice determines whether the cooldown is active
    function isCooldownActive() external view returns (bool);

    /// @notice address of the current operator
    function operator() external view returns (address);

    /// @notice accessHub address
    function accessHub() external view returns (address);

    /// @notice returns the ratio of xShadow per X33 token
    function ratio() external view returns (uint256 _ratio);

    /// @notice the most recent active period the contract has interacted in
    function activePeriod() external view returns (uint256);

    /// @notice whether the periods are unlocked
    function periodUnlockStatus(uint256 _period) external view returns (bool unlocked);

    /// @notice the shadow token
    function shadow() external view returns (IERC20);

    /// @notice the xShadow token
    function xShadow() external view returns (IXShadow);
}

File 7 of 42 : IShadowV3Factory.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title The interface for the Shadow V3 Factory
/// @notice The Shadow V3 Factory facilitates creation of Shadow V3 pools and control over the protocol fees
interface IShadowV3Factory {
    error IT();
    /// @dev Fee Too Large
    error FTL();
    error A0();
    error F0();
    error PE();
    /// @dev out of bounds
    error OOB(uint8);

    /// @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 tickspacing amount is enabled for pool creation via the factory
    /// @dev unlike UniswapV3, we map via the tickSpacing rather than the fee tier
    /// @param tickSpacing The minimum number of ticks between initialized ticks
    /// @param fee The fee, denominated in hundredths of a bip
    event TickSpacingEnabled(int24 indexed tickSpacing, uint24 indexed fee);

    /// @notice Emitted when the protocol fee is changed
    /// @param feeProtocolOld The previous value of the protocol fee
    /// @param feeProtocolNew The updated value of the protocol fee
    event SetFeeProtocol(uint8 feeProtocolOld, uint8 feeProtocolNew);

    /// @notice Emitted when the protocol fee is changed
    /// @param pool The pool address
    /// @param feeProtocolOld The previous value of the protocol fee
    /// @param feeProtocolNew The updated value of the protocol fee
    event SetPoolFeeProtocol(address pool, uint8 feeProtocolOld, uint8 feeProtocolNew);

    /// @notice Emitted when a pool's fee is changed
    /// @param pool The pool address
    /// @param newFee The updated value of the protocol fee
    event FeeAdjustment(address pool, uint24 newFee);

    /// @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 PoolDeployer address
    /// @return The address of the PoolDeployer contract
    function shadowV3PoolDeployer() external returns (address);

    /// @notice Returns the fee amount for a given tickSpacing, if enabled, or 0 if not enabled
    /// @dev A tickSpacing can never be removed, so this value should be hard coded or cached in the calling context
    /// @dev unlike UniswapV3, we map via the tickSpacing rather than the fee tier
    /// @param tickSpacing The enabled tickSpacing. Returns 0 in case of unenabled tickSpacing
    /// @return initialFee The initial fee
    function tickSpacingInitialFee(int24 tickSpacing) external view returns (uint24 initialFee);

    /// @notice Returns the pool address for a given pair of tokens and a tickSpacing, or address 0 if it does not exist
    /// @dev tokenA and tokenB may be passed in either token0/token1 or token1/token0 order
    /// @dev unlike UniswapV3, we map via the tickSpacing rather than the fee tier
    /// @param tokenA The contract address of either token0 or token1
    /// @param tokenB The contract address of the other token
    /// @param tickSpacing The tickSpacing of the pool
    /// @return pool The pool address
    function getPool(address tokenA, address tokenB, int24 tickSpacing) external view returns (address pool);

    /// @notice Creates a pool for the given two tokens and fee
    /// @dev unlike UniswapV3, we map via the tickSpacing rather than the fee tier
    /// @param tokenA One of the two tokens in the desired pool
    /// @param tokenB The other of the two tokens in the desired pool
    /// @param tickSpacing The desired tickSpacing for the pool
    /// @param sqrtPriceX96 initial sqrtPriceX96 of the pool
    /// @dev tokenA and tokenB may be passed in either order: token0/token1 or token1/token0.
    /// @dev The call will revert if the pool already exists, the tickSpacing is invalid, or the token arguments are invalid.
    /// @return pool The address of the newly created pool
    function createPool(address tokenA, address tokenB, int24 tickSpacing, uint160 sqrtPriceX96)
        external
        returns (address pool);

    /// @notice Enables a tickSpacing with the given initialFee amount
    /// @dev unlike UniswapV3, we map via the tickSpacing rather than the fee tier
    /// @dev tickSpacings may never be removed once enabled
    /// @param tickSpacing The spacing between ticks to be enforced for all pools created
    /// @param initialFee The initial fee amount, denominated in hundredths of a bip (i.e. 1e-6)
    function enableTickSpacing(int24 tickSpacing, uint24 initialFee) external;

    /// @notice Returns the default protocol fee value
    /// @return _feeProtocol The default protocol fee percentage
    function feeProtocol() external view returns (uint8 _feeProtocol);

    /// @notice Returns the protocol fee percentage for a specific pool
    /// @dev If the fee is 0 or the pool is uninitialized, returns the Factory's default feeProtocol
    /// @param pool The address of the pool
    /// @return _feeProtocol The protocol fee percentage for the specified pool
    function poolFeeProtocol(address pool) external view returns (uint8 _feeProtocol);

    /// @notice Sets the default protocol fee percentage
    /// @param _feeProtocol New default protocol fee percentage for token0 and token1
    function setFeeProtocol(uint8 _feeProtocol) external;

    /// @notice Retrieves the parameters used in constructing a pool
    /// @dev Called by the pool constructor to fetch the pool's parameters
    /// @return factory The factory address
    /// @return token0 The first token of the pool by address sort order
    /// @return token1 The second token of the pool by address sort order
    /// @return fee The initialized fee tier of the pool, denominated in hundredths of a bip
    /// @return tickSpacing The minimum number of ticks between initialized ticks
    function parameters()
        external
        view
        returns (address factory, address token0, address token1, uint24 fee, int24 tickSpacing);

    /// @notice Updates the fee collector address
    /// @param _feeCollector The new fee collector address
    function setFeeCollector(address _feeCollector) external;

    /// @notice Updates the swap fee for a specific pool
    /// @param _pool The address of the pool to modify
    /// @param _fee The new fee value, scaled where 1_000_000 = 100%
    function setFee(address _pool, uint24 _fee) external;

    /// @notice Returns the current fee collector address
    /// @dev The fee collector contract determines the distribution of protocol fees
    /// @return The address of the fee collector contract
    function feeCollector() external view returns (address);

    /// @notice Updates the protocol fee percentage for a specific pool
    /// @param pool The address of the pool to modify
    /// @param _feeProtocol The new protocol fee percentage to assign
    function setPoolFeeProtocol(address pool, uint8 _feeProtocol) external;

    /// @notice Enables fee protocol splitting upon gauge creation
    /// @param pool The address of the pool to enable fee splitting for
    function gaugeFeeSplitEnable(address pool) external;

    /// @notice Updates the voter contract address
    /// @param _voter The new voter contract address
    function setVoter(address _voter) external;

    /// @notice Checks if a given address is a V3 pool
    /// @param _pool The address to check
    /// @return isV3 True if the address is a V3 pool, false otherwise
    function isPairV3(address _pool) external view returns (bool isV3);

    /// @notice Initializes the factory with a pool deployer
    /// @param poolDeployer The address of the pool deployer contract
    function initialize(address poolDeployer) external;
}

File 8 of 42 : IShadowV3Pool.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

import {IShadowV3PoolImmutables} from "./pool/IShadowV3PoolImmutables.sol";
import {IShadowV3PoolState} from "./pool/IShadowV3PoolState.sol";
import {IShadowV3PoolDerivedState} from "./pool/IShadowV3PoolDerivedState.sol";
import {IShadowV3PoolActions} from "./pool/IShadowV3PoolActions.sol";
import {IShadowV3PoolOwnerActions} from "./pool/IShadowV3PoolOwnerActions.sol";
import {IShadowV3PoolErrors} from "./pool/IShadowV3PoolErrors.sol";
import {IShadowV3PoolEvents} from "./pool/IShadowV3PoolEvents.sol";

/// @title The interface for a Shadow V3 Pool
/// @notice A Shadow pool facilitates swapping and automated market making between any two assets that strictly conform
/// to the ERC20 specification
/// @dev The pool interface is broken up into many smaller pieces
interface IShadowV3Pool is
    IShadowV3PoolImmutables,
    IShadowV3PoolState,
    IShadowV3PoolDerivedState,
    IShadowV3PoolActions,
    IShadowV3PoolOwnerActions,
    IShadowV3PoolErrors,
    IShadowV3PoolEvents
{
    /// @notice if a new period, advance on interaction
    function _advancePeriod() external;

    /// @notice Get the index of the last period in the pool
    /// @return The index of the last period
    function lastPeriod() external view returns (uint256);
}

File 9 of 42 : IGaugeV3.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.x;

interface IGaugeV3 {
    error NOT_AUTHORIZED();
    error NOT_VOTER();
    error NOT_GT_ZERO(uint256 amt);
    error CANT_CLAIM_FUTURE();
    error RETRO();

    /// @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 Retrieves the value of the firstPeriod variable.
    /// @return The value of the firstPeriod variable.
    function firstPeriod() external returns (uint256);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    /// @notice retrieves rewards based on an NFP id and an array of tokens
    function getReward(uint256 tokenId, address[] memory tokens) external;
    /// @notice retrieves rewards based on an array of NFP ids and an array of tokens
    function getReward(
        uint256[] calldata tokenIds,
        address[] memory tokens
    ) external;
    /// @notice get reward for an owner of an NFP
    function getRewardForOwner(
        uint256 tokenId,
        address[] memory tokens
    ) external;

    function addRewards(address reward) external;

    function removeRewards(address reward) 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;
}

File 10 of 42 : IFeeCollector.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.x;

import {IShadowV3Pool} from "../../core/interfaces/IShadowV3Pool.sol";

interface IFeeCollector {
    error NOT_AUTHORIZED();
    error FTL();

    /// @notice Emitted when the treasury address is changed.
    /// @param oldTreasury The previous treasury address.
    /// @param newTreasury The new treasury address.
    event TreasuryChanged(address oldTreasury, address newTreasury);

    /// @notice Emitted when the treasury fees value is changed.
    /// @param oldTreasuryFees The previous value of the treasury fees.
    /// @param newTreasuryFees The new value of the treasury fees.
    event TreasuryFeesChanged(uint256 oldTreasuryFees, uint256 newTreasuryFees);

    /// @notice Emitted when protocol fees are collected from a pool and distributed to the fee distributor and treasury.
    /// @param pool The address of the pool from which the fees were collected.
    /// @param feeDistAmount0 The amount of fee tokens (token 0) distributed to the fee distributor.
    /// @param feeDistAmount1 The amount of fee tokens (token 1) distributed to the fee distributor.
    /// @param treasuryAmount0 The amount of fee tokens (token 0) allocated to the treasury.
    /// @param treasuryAmount1 The amount of fee tokens (token 1) allocated to the treasury.
    event FeesCollected(
        address pool,
        uint256 feeDistAmount0,
        uint256 feeDistAmount1,
        uint256 treasuryAmount0,
        uint256 treasuryAmount1
    );

    /// @notice Returns the treasury address.
    function treasury() external returns (address);

    /// @notice Sets the treasury address to a new value.
    /// @param newTreasury The new address to set as the treasury.
    function setTreasury(address newTreasury) external;

    /// @notice Sets the value of treasury fees to a new amount.
    /// @param _treasuryFees The new amount of treasury fees to be set.
    function setTreasuryFees(uint256 _treasuryFees) external;

    /// @notice Collects protocol fees from a specified pool and distributes them to the fee distributor and treasury.
    /// @param pool The pool from which to collect the protocol fees.
    function collectProtocolFees(IShadowV3Pool pool) external;
}

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

import {IPoolInitializer} from './IPoolInitializer.sol';
import {IPeripheryPayments} from './IPeripheryPayments.sol';
import {IPeripheryImmutableState} from './IPeripheryImmutableState.sol';
import {PoolAddress} from '../libraries/PoolAddress.sol';

import {IERC721} from '@openzeppelin/contracts/token/ERC721/IERC721.sol';
import {IERC721Metadata} from '@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol';
import {IERC721Enumerable} from '@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol';

import {IPeripheryErrors} from './IPeripheryErrors.sol';

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

    /// @notice Returns the position information associated with a given token ID.
    /// @dev Throws if the token ID is not valid.
    /// @param tokenId The ID of the token that represents the position
    /// @return token0 The address of the token0 for a specific pool
    /// @return token1 The address of the token1 for a specific pool
    /// @return tickSpacing The tickSpacing 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 (
            address token0,
            address token1,
            int24 tickSpacing,
            int24 tickLower,
            int24 tickUpper,
            uint128 liquidity,
            uint256 feeGrowthInside0LastX128,
            uint256 feeGrowthInside1LastX128,
            uint128 tokensOwed0,
            uint128 tokensOwed1
        );

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

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

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

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

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

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

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

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

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

    /// @notice Claims gauge rewards from liquidity incentives for a specific tokenId
    /// @param tokenId The ID of the token to claim rewards from
    /// @param tokens an array of reward tokens to claim
    function getReward(uint256 tokenId, address[] calldata tokens) external;
}

File 12 of 42 : IPairFactory.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.x;

interface IPairFactory {
    error FEE_TOO_HIGH();
    error ZERO_FEE();
    /// @dev invalid assortment
    error IA();
    /// @dev zero address
    error ZA();
    /// @dev pair exists
    error PE();
    error NOT_AUTHORIZED();
    error INVALID_FEE_SPLIT();

    event PairCreated(
        address indexed token0,
        address indexed token1,
        address pair,
        uint256
    );

    event SetFee(uint256 indexed fee);

    event SetPairFee(address indexed pair, uint256 indexed fee);

    event SetFeeSplit(uint256 indexed _feeSplit);

    event SetPairFeeSplit(address indexed pair, uint256 indexed _feeSplit);

    event SkimStatus(address indexed _pair, bool indexed _status);

    event NewTreasury(address indexed _caller, address indexed _newTreasury);

    event FeeSplitWhenNoGauge(address indexed _caller, bool indexed _status);

    event SetFeeRecipient(address indexed pair, address indexed feeRecipient);

    /// @notice returns the total length of legacy pairs
    /// @return _length the length
    function allPairsLength() external view returns (uint256 _length);

    /// @notice calculates if the address is a legacy pair
    /// @param pair the address to check
    /// @return _boolean the bool return
    function isPair(address pair) external view returns (bool _boolean);

    /// @notice calculates the pairCodeHash
    /// @return _hash the pair code hash
    function pairCodeHash() external view returns (bytes32 _hash);

    /// @param tokenA address of tokenA
    /// @param tokenB address of tokenB
    /// @param stable whether it uses the stable curve
    /// @return _pair the address of the pair
    function getPair(
        address tokenA,
        address tokenB,
        bool stable
    ) external view returns (address _pair);

    /// @notice creates a new legacy pair
    /// @param tokenA address of tokenA
    /// @param tokenB address of tokenB
    /// @param stable whether it uses the stable curve
    /// @return pair the address of the created pair
    function createPair(
        address tokenA,
        address tokenB,
        bool stable
    ) external returns (address pair);

    /// @notice the address of the voter
    /// @return _voter the address of the voter
    function voter() external view returns (address _voter);

    /// @notice returns the address of a pair based on the index
    /// @param _index the index to check for a pair
    /// @return _pair the address of the pair at the index
    function allPairs(uint256 _index) external view returns (address _pair);

    /// @notice the swap fee of a pair
    /// @param _pair the address of the pair
    /// @return _fee the fee
    function pairFee(address _pair) external view returns (uint256 _fee);

    /// @notice the split of fees
    /// @return _split the feeSplit
    function feeSplit() external view returns (uint256 _split);

    /// @notice sets the swap fee for a pair
    /// @param _pair the address of the pair
    /// @param _fee the fee for the pair
    function setPairFee(address _pair, uint256 _fee) external;

    /// @notice set the swap fees of the pair
    /// @param _fee the fee, scaled to MAX 10% of 100_000
    function setFee(uint256 _fee) external;

    /// @notice the address for the treasury
    /// @return _treasury address of the treasury
    function treasury() external view returns (address _treasury);

    /// @notice sets the pairFees contract
    /// @param _pair the address of the pair
    /// @param _pairFees the address of the new Pair Fees
    function setFeeRecipient(address _pair, address _pairFees) external;

    /// @notice sets the feeSplit for a pair
    /// @param _pair the address of the pair
    /// @param _feeSplit the feeSplit
    function setPairFeeSplit(address _pair, uint256 _feeSplit) external;

    /// @notice whether there is feeSplit when there's no gauge
    /// @return _boolean whether there is a feesplit when no gauge
    function feeSplitWhenNoGauge() external view returns (bool _boolean);

    /// @notice whether a pair can be skimmed
    /// @param _pair the pair address
    /// @return _boolean whether skim is enabled
    function skimEnabled(address _pair) external view returns (bool _boolean);

    /// @notice set whether skim is enabled for a specific pair
    function setSkimEnabled(address _pair, bool _status) external;

    /// @notice sets a new treasury address
    /// @param _treasury the new treasury address
    function setTreasury(address _treasury) external;

    /// @notice set whether there should be a feesplit without gauges
    /// @param status whether enabled or not
    function setFeeSplitWhenNoGauge(bool status) external;

    /// @notice sets the feesSplit globally
    /// @param _feeSplit the fee split
    function setFeeSplit(uint256 _feeSplit) external;
}

File 13 of 42 : IFeeRecipientFactory.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.x;

interface IFeeRecipientFactory {
    error INVALID_TREASURY_FEE();
    error NOT_AUTHORIZED();

    /// @notice the pair fees for a specific pair
    /// @param pair the pair to check
    /// @return feeRecipient the feeRecipient contract address for the pair
    function feeRecipientForPair(
        address pair
    ) external view returns (address feeRecipient);

    /// @notice the last feeRecipient address created
    /// @return _feeRecipient the address of the last pair fees contract
    function lastFeeRecipient() external view returns (address _feeRecipient);
    /// @notice create the pair fees for a pair
    /// @param pair the address of the pair
    /// @return _feeRecipient the address of the newly created feeRecipient
    function createFeeRecipient(
        address pair
    ) external returns (address _feeRecipient);

    /// @notice the fee % going to the treasury
    /// @return _feeToTreasury the fee %
    function feeToTreasury() external view returns (uint256 _feeToTreasury);

    /// @notice get the treasury address
    /// @return _treasury address of the treasury
    function treasury() external view returns (address _treasury);

    /// @notice set the fee % to be sent to the treasury
    /// @param _feeToTreasury the fee % to be sent to the treasury
    function setFeeToTreasury(uint256 _feeToTreasury) external;

    /// @notice set a new treasury address
    /// @param _treasury the new address
    function setTreasury(address _treasury) external;
}

File 14 of 42 : IVoter.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.x;
pragma abicoder v2;

interface IVoter {
    error ACTIVE_GAUGE(address gauge);

    error GAUGE_INACTIVE(address gauge);

    error ALREADY_WHITELISTED(address token);

    error NOT_AUTHORIZED(address caller);

    error NOT_WHITELISTED();

    error NOT_POOL();

    error NOT_INIT();

    error LENGTH_MISMATCH();

    error NO_GAUGE();

    error ALREADY_DISTRIBUTED(address gauge, uint256 period);

    error ZERO_VOTE(address pool);

    error RATIO_TOO_HIGH(uint256 _xRatio);

    error VOTE_UNSUCCESSFUL();

    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 owner, uint256 weight, address indexed pool);

    event Abstained(address indexed owner, uint256 weight);

    event Deposit(
        address indexed lp,
        address indexed gauge,
        address indexed owner,
        uint256 amount
    );

    event Withdraw(
        address indexed lp,
        address indexed gauge,
        address indexed owner,
        uint256 amount
    );

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

    event DistributeReward(
        address indexed sender,
        address indexed gauge,
        uint256 amount
    );

    event EmissionsRatio(
        address indexed caller,
        uint256 oldRatio,
        uint256 newRatio
    );

    event NewGovernor(address indexed sender, address indexed governor);

    event Whitelisted(address indexed whitelister, address indexed token);

    event WhitelistRevoked(
        address indexed forbidder,
        address indexed token,
        bool status
    );

    event MainTickSpacingChanged(
        address indexed token0,
        address indexed token1,
        int24 indexed newMainTickSpacing
    );

    event Poke(address indexed user);

    function initialize(
        address _shadow,
        address _legacyFactory,
        address _gauges,
        address _feeDistributorFactory,
        address _minter,
        address _msig,
        address _xShadow,
        address _clFactory,
        address _clGaugeFactory,
        address _nfpManager,
        address _feeRecipientFactory,
        address _voteModule,
        address _launcherPlugin
    ) external;

    /// @notice denominator basis
    function BASIS() external view returns (uint256);

    /// @notice ratio of xShadow emissions globally
    function xRatio() external view returns (uint256);

    /// @notice xShadow contract address
    function xShadow() external view returns (address);

    /// @notice legacy factory address (uni-v2/stableswap)
    function legacyFactory() external view returns (address);

    /// @notice concentrated liquidity factory
    function clFactory() external view returns (address);

    /// @notice gauge factory for CL
    function clGaugeFactory() external view returns (address);

    /// @notice legacy fee recipient factory
    function feeRecipientFactory() external view returns (address);

    /// @notice peripheral NFPManager contract
    function nfpManager() external view returns (address);

    /// @notice returns the address of the current governor
    /// @return _governor address of the governor
    function governor() external view returns (address _governor);

    /// @notice the address of the vote module
    /// @return _voteModule the vote module contract address
    function voteModule() external view returns (address _voteModule);

    /// @notice address of the central access Hub
    function accessHub() external view returns (address);

    /// @notice the address of the shadow launcher plugin to enable third party launchers
    /// @return _launcherPlugin the address of the plugin
    function launcherPlugin() external view returns (address _launcherPlugin);

    /// @notice distributes emissions from the minter to the voter
    /// @param amount the amount of tokens to notify
    function notifyRewardAmount(uint256 amount) external;

    /// @notice distributes the emissions for a specific gauge
    /// @param _gauge the gauge address
    function distribute(address _gauge) external;

    /// @notice returns the address of the gauge factory
    /// @param _gaugeFactory gauge factory address
    function gaugeFactory() external view returns (address _gaugeFactory);

    /// @notice returns the address of the feeDistributor factory
    /// @return _feeDistributorFactory feeDist factory address
    function feeDistributorFactory()
        external
        view
        returns (address _feeDistributorFactory);

    /// @notice returns the address of the minter contract
    /// @return _minter address of the minter
    function minter() external view returns (address _minter);

    /// @notice check if the gauge is active for governance use
    /// @param _gauge address of the gauge
    /// @return _trueOrFalse if the gauge is alive
    function isAlive(address _gauge) external view returns (bool _trueOrFalse);

    /// @notice allows the token to be paired with other whitelisted assets to participate in governance
    /// @param _token the address of the token
    function whitelist(address _token) external;

    /// @notice effectively disqualifies a token from governance
    /// @param _token the address of the token
    function revokeWhitelist(address _token) external;

    /// @notice returns if the address is a gauge
    /// @param gauge address of the gauge
    /// @return _trueOrFalse boolean if the address is a gauge
    function isGauge(address gauge) external view returns (bool _trueOrFalse);

    /// @notice disable a gauge from governance
    /// @param _gauge address of the gauge
    function killGauge(address _gauge) external;

    /// @notice re-activate a dead gauge
    /// @param _gauge address of the gauge
    function reviveGauge(address _gauge) external;

    /// @notice re-cast a tokenID's votes
    /// @param owner address of the owner
    function poke(address owner) external;

    /// @notice sets the main tickspacing of a token pairing
    /// @param tokenA address of tokenA
    /// @param tokenB address of tokenB
    /// @param tickSpacing the main tickspacing to set to
    function setMainTickSpacing(
        address tokenA,
        address tokenB,
        int24 tickSpacing
    ) external;

    /// @notice returns if the address is a fee distributor
    /// @param _feeDistributor address of the feeDist
    /// @return _trueOrFalse if the address is a fee distributor
    function isFeeDistributor(
        address _feeDistributor
    ) external view returns (bool _trueOrFalse);

    /// @notice returns the address of the emission's token
    /// @return _shadow emissions token contract address
    function shadow() external view returns (address _shadow);

    /// @notice returns the address of the pool's gauge, if any
    /// @param _pool pool address
    /// @return _gauge gauge address
    function gaugeForPool(address _pool) external view returns (address _gauge);

    /// @notice returns the address of the pool's feeDistributor, if any
    /// @param _gauge address of the gauge
    /// @return _feeDistributor address of the pool's feedist
    function feeDistributorForGauge(
        address _gauge
    ) external view returns (address _feeDistributor);

    /// @notice returns the new toPool that was redirected fromPool
    /// @param fromPool address of the original pool
    /// @return toPool the address of the redirected pool
    function poolRedirect(
        address fromPool
    ) external view returns (address toPool);

    /// @notice returns the gauge address of a CL pool
    /// @param tokenA address of token A in the pair
    /// @param tokenB address of token B in the pair
    /// @param tickSpacing tickspacing of the pool
    /// @return gauge address of the gauge
    function gaugeForClPool(
        address tokenA,
        address tokenB,
        int24 tickSpacing
    ) external view returns (address gauge);

    /// @notice returns the array of all tickspacings for the tokenA/tokenB combination
    /// @param tokenA address of token A in the pair
    /// @param tokenB address of token B in the pair
    /// @return _ts array of all the tickspacings
    function tickSpacingsForPair(
        address tokenA,
        address tokenB
    ) external view returns (int24[] memory _ts);

    /// @notice returns the main tickspacing used in the gauge/governance process
    /// @param tokenA address of token A in the pair
    /// @param tokenB address of token B in the pair
    /// @return _ts the main tickspacing
    function mainTickSpacingForPair(
        address tokenA,
        address tokenB
    ) external view returns (int24 _ts);

    /// @notice returns the block.timestamp divided by 1 week in seconds
    /// @return period the period used for gauges
    function getPeriod() external view returns (uint256 period);

    /// @notice cast a vote to direct emissions to gauges and earn incentives
    /// @param owner address of the owner
    /// @param _pools the list of pools to vote on
    /// @param _weights an arbitrary weight per pool which will be normalized to 100% regardless of numerical inputs
    function vote(
        address owner,
        address[] calldata _pools,
        uint256[] calldata _weights
    ) external;

    /// @notice reset the vote of an address
    /// @param owner address of the owner
    function reset(address owner) external;

    /// @notice set the governor address
    /// @param _governor the new governor address
    function setGovernor(address _governor) external;

    /// @notice recover stuck emissions
    /// @param _gauge the gauge address
    /// @param _period the period
    function stuckEmissionsRecovery(address _gauge, uint256 _period) external;

    /// @notice whitelists extra rewards for a gauge
    /// @param _gauge the gauge to whitelist rewards to
    /// @param _reward the reward to whitelist
    function whitelistGaugeRewards(address _gauge, address _reward) external;

    /// @notice removes a reward from the gauge whitelist
    /// @param _gauge the gauge to remove the whitelist from
    /// @param _reward the reward to remove from the whitelist
    function removeGaugeRewardWhitelist(
        address _gauge,
        address _reward
    ) external;

    /// @notice creates a legacy gauge for the pool
    /// @param _pool pool's address
    /// @return _gauge address of the new gauge
    function createGauge(address _pool) external returns (address _gauge);

    /// @notice create a concentrated liquidity gauge
    /// @param tokenA the address of tokenA
    /// @param tokenB the address of tokenB
    /// @param tickSpacing the tickspacing of the pool
    /// @return _clGauge address of the new gauge
    function createCLGauge(
        address tokenA,
        address tokenB,
        int24 tickSpacing
    ) external returns (address _clGauge);

    /// @notice claim concentrated liquidity gauge rewards for specific NFP token ids
    /// @param _gauges array of gauges
    /// @param _tokens two dimensional array for the tokens to claim
    /// @param _nfpTokenIds two dimensional array for the NFPs
    function claimClGaugeRewards(
        address[] calldata _gauges,
        address[][] calldata _tokens,
        uint256[][] calldata _nfpTokenIds
    ) external;

    /// @notice claim arbitrary rewards from specific feeDists
    /// @param owner address of the owner
    /// @param _feeDistributors address of the feeDists
    /// @param _tokens two dimensional array for the tokens to claim
    function claimIncentives(
        address owner,
        address[] calldata _feeDistributors,
        address[][] calldata _tokens
    ) external;

    /// @notice claim arbitrary rewards from specific gauges
    /// @param _gauges address of the gauges
    /// @param _tokens two dimensional array for the tokens to claim
    function claimRewards(
        address[] calldata _gauges,
        address[][] calldata _tokens
    ) external;

    /// @notice claim arbitrary rewards from specific legacy gauges, and exit to shadow
    /// @param _gauges address of the gauges
    /// @param _tokens two dimensional array for the tokens to claim
    function claimLegacyRewardsAndExit(
        address[] calldata _gauges,
        address[][] calldata _tokens
    ) external;

    /// @notice distribute emissions to a gauge for a specific period
    /// @param _gauge address of the gauge
    /// @param _period value of the period
    function distributeForPeriod(address _gauge, uint256 _period) external;

    /// @notice attempt distribution of emissions to all gauges
    function distributeAll() external;

    /// @notice distribute emissions to gauges by index
    /// @param startIndex start of the loop
    /// @param endIndex end of the loop
    function batchDistributeByIndex(
        uint256 startIndex,
        uint256 endIndex
    ) external;

    /// @notice returns the votes cast for a tokenID
    /// @param owner address of the owner
    /// @return votes an array of votes casted
    /// @return weights an array of the weights casted per pool
    function getVotes(
        address owner,
        uint256 period
    ) external view returns (address[] memory votes, uint256[] memory weights);

    /// @notice returns an array of all the gauges
    /// @return _gauges the array of gauges
    function getAllGauges() external view returns (address[] memory _gauges);

    /// @notice returns an array of all the feeDists
    /// @return _feeDistributors the array of feeDists
    function getAllFeeDistributors()
        external
        view
        returns (address[] memory _feeDistributors);

    /// @notice sets the xShadowRatio default
    function setGlobalRatio(uint256 _xRatio) external;

    /// @notice whether the token is whitelisted in governance
    function isWhitelisted(address _token) external view returns (bool _tf);

    /// @notice function for removing malicious or stuffed tokens
    function removeFeeDistributorReward(
        address _feeDist,
        address _token
    ) external;

    /// @notice returns the total votes for a pool in a specific period
    /// @param pool the pool address to check
    /// @param period the period to check
    /// @return votes the total votes for the pool in that period
    function poolTotalVotesPerPeriod(address pool, uint256 period) external view returns (uint256 votes);

    /// @notice returns the pool address for a given gauge
    /// @param gauge address of the gauge
    /// @return pool address of the pool
    function poolForGauge(address gauge) external view returns (address pool);

    /// @notice returns the total votes for a specific period
    /// @param period the period to check
    /// @return weight the total votes for that period
    function totalVotesPerPeriod(uint256 period) external view returns (uint256 weight);

    /// @notice returns the total rewards allocated for a specific period
    /// @param period the period to check
    /// @return amount the total rewards for that period
    function totalRewardPerPeriod(uint256 period) external view returns (uint256 amount);

    /// @notice returns the last distribution period for a gauge
    /// @param _gauge address of the gauge
    /// @return period the last period distributions occurred
    function lastDistro(address _gauge) external view returns (uint256 period);

}

File 15 of 42 : IMinter.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.x;

interface IMinter {
    /// @dev error for if epoch 0 has already started
    error STARTED();
    /// @dev error for if update_period is attempted to be called before startEmissions
    error EMISSIONS_NOT_STARTED();
    /// @dev deviation too high
    error TOO_HIGH();
    /// @dev no change in values
    error NO_CHANGE();
    /// @dev when attempting to update emissions more than once per period
    error SAME_PERIOD();
    /// @dev error for if a contract is not set correctly
    error INVALID_CONTRACT();   

    event SetVeDist(address _value);
    event SetVoter(address _value);
    event Mint(address indexed sender, uint256 weekly);
    event RebaseUnsuccessful(uint256 _current, uint256 _currentPeriod);
    event EmissionsMultiplierUpdated(uint256 _emissionsMultiplier);

    /// @notice decay or inflation scaled to 10_000 = 100%
    /// @return _multiplier the emissions multiplier
    function emissionsMultiplier() external view returns (uint256 _multiplier);

    /// @notice unix timestamp of current epoch's start
    /// @return _activePeriod the active period
    function activePeriod() external view returns (uint256 _activePeriod);

    /// @notice update the epoch (period) -- callable once a week at >= Thursday 0 UTC
    /// @return period the new period
    function updatePeriod() external returns (uint256 period);

    /// @notice start emissions for epoch 0
    function startEmissions() external;

    /// @notice updates the decay or inflation scaled to 10_000 = 100%
    /// @param _emissionsMultiplier multiplier for emissions each week
    function updateEmissionsMultiplier(uint256 _emissionsMultiplier) external;

    /// @notice calculates the emissions to be sent to the voter
    /// @return _weeklyEmissions the amount of emissions for the week
    function calculateWeeklyEmissions()
        external
        view
        returns (uint256 _weeklyEmissions);

    /// @notice kicks off the initial minting and variable declarations
    function kickoff(
        address _shadow,
        address _voter,
        uint256 _initialWeeklyEmissions,
        uint256 _initialMultiplier,
        address _xShadow
    ) external;

    /// @notice returns (block.timestamp / 1 week) for gauge use
    /// @return period period number
    function getPeriod() external view returns (uint256 period);

    /// @notice returns the numerical value of the current epoch
    /// @return _epoch epoch number
    function getEpoch() external view returns (uint256 _epoch);
}

File 16 of 42 : IVoteModule.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.x;

interface IVoteModule {
    /** Custom Errors */

    /// @dev == 0
    error ZERO_AMOUNT();

    /// @dev if address is not xShadow
    error NOT_XSHADOW();

    /// @dev error for when the cooldown period has not been passed yet
    error COOLDOWN_ACTIVE();

    /// @dev error for when you try to deposit or withdraw for someone who isn't the msg.sender
    error NOT_VOTEMODULE();

    /// @dev error for when the caller is not authorized
    error UNAUTHORIZED();

    /// @dev error for accessHub gated functions
    error NOT_ACCESSHUB();

    /// @dev error for when there is no change of state
    error NO_CHANGE();

    /// @dev error for when address is invalid
    error INVALID_ADDRESS();

    /** Events */

    event Deposit(address indexed from, uint256 amount);

    event Withdraw(address indexed from, uint256 amount);

    event NotifyReward(address indexed from, uint256 amount);

    event ClaimRewards(address indexed from, uint256 amount);

    event ExemptedFromCooldown(address indexed candidate, bool status);

    event NewDuration(uint256 oldDuration, uint256 newDuration);

    event NewCooldown(uint256 oldCooldown, uint256 newCooldown);

    event Delegate(
        address indexed delegator,
        address indexed delegatee,
        bool indexed isAdded
    );

    event SetAdmin(
        address indexed owner,
        address indexed operator,
        bool indexed isAdded
    );

    /** Functions */
    function delegates(address) external view returns (address);
    /// @notice mapping for admins for a specific address
    /// @param owner the owner to check against
    /// @return operator the address that is designated as an admin/operator
    function admins(address owner) external view returns (address operator);

    function accessHub() external view returns(address);

    /// @notice returns the last time the reward was modified or periodFinish if the reward has ended
    function lastTimeRewardApplicable() external view returns (uint256 _ltra);

    function earned(address account) external view returns (uint256 _reward);
    /// @notice the time which users can deposit and withdraw
    function unlockTime() external view returns (uint256 _timestamp);

    /// @notice claims pending rebase rewards
    function getReward() external;

    function rewardPerToken() external view returns (uint256 _rewardPerToken);

    /// @notice deposits all xShadow in the caller's wallet
    function depositAll() external;

    /// @notice deposit a specified amount of xShadow
    function deposit(uint256 amount) external;

    /// @notice withdraw all xShadow
    function withdrawAll() external;

    /// @notice withdraw a specified amount of xShadow
    function withdraw(uint256 amount) external;

    /// @notice check for admin perms
    /// @param operator the address to check
    /// @param owner the owner to check against for permissions
    function isAdminFor(
        address operator,
        address owner
    ) external view returns (bool approved);

    /// @notice check for delegations
    /// @param delegate the address to check
    /// @param owner the owner to check against for permissions
    function isDelegateFor(
        address delegate,
        address owner
    ) external view returns (bool approved);

    /// @notice rewards pending to be distributed for the reward period
    /// @return _left rewards remaining in the period
    function left() external view returns (uint256 _left);

    /// @notice used by the xShadow contract to notify pending rebases
    /// @param amount the amount of Shadow to be notified from exit penalties
    function notifyRewardAmount(uint256 amount) external;

    /// @notice the address of the xShadow token (staking/voting token)
    /// @return _xShadow the address
    function xShadow() external view returns (address _xShadow);

    /// @notice address of the voter contract
    /// @return _voter the voter contract address
    function voter() external view returns (address _voter);

    /// @notice returns the total voting power (equal to total supply in the VoteModule)
    /// @return _totalSupply the total voting power
    function totalSupply() external view returns (uint256 _totalSupply);

    /// @notice last time the rewards system was updated
    function lastUpdateTime() external view returns (uint256 _lastUpdateTime);

    /// @notice rewards per xShadow
    /// @return _rewardPerToken the amount of rewards per xShadow
    function rewardPerTokenStored()
        external
        view
        returns (uint256 _rewardPerToken);

    /// @notice when the 1800 seconds after notifying are up
    function periodFinish() external view returns (uint256 _periodFinish);

    /// @notice calculates the rewards per second
    /// @return _rewardRate the rewards distributed per second
    function rewardRate() external view returns (uint256 _rewardRate);

    /// @notice voting power
    /// @param user the address to check
    /// @return amount the staked balance
    function balanceOf(address user) external view returns (uint256 amount);

    /// @notice rewards per amount of xShadow's staked
    function userRewardPerTokenStored(
        address user
    ) external view returns (uint256 rewardPerToken);

    /// @notice the amount of rewards claimable for the user
    /// @param user the address of the user to check
    /// @return rewards the stored rewards
    function storedRewardsPerUser(
        address user
    ) external view returns (uint256 rewards);

    /// @notice delegate voting perms to another address
    /// @param delegatee who you delegate to
    /// @dev set address(0) to revoke
    function delegate(address delegatee) external;

    /// @notice give admin permissions to a another address
    /// @param operator the address to give administrative perms to
    /// @dev set address(0) to revoke
    function setAdmin(address operator) external;

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

    function setCooldownExemption(address, bool) external;

    function setNewDuration(uint) external;

    function setNewCooldown(uint) external;
}

File 17 of 42 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

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

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

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

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

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

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

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

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

File 18 of 42 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol)

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    bool private _paused;

    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    /**
     * @dev The operation failed because the contract is paused.
     */
    error EnforcedPause();

    /**
     * @dev The operation failed because the contract is not paused.
     */
    error ExpectedPause();

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        if (paused()) {
            revert EnforcedPause();
        }
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        if (!paused()) {
            revert ExpectedPause();
        }
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

File 19 of 42 : IAccessControlEnumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (access/extensions/IAccessControlEnumerable.sol)

pragma solidity ^0.8.20;

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

/**
 * @dev External interface of AccessControlEnumerable declared to support ERC-165 detection.
 */
interface IAccessControlEnumerable is IAccessControl {
    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) external view returns (address);

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) external view returns (uint256);
}

File 20 of 42 : AccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)

pragma solidity ^0.8.20;

import {IAccessControl} from "@openzeppelin/contracts/access/IAccessControl.sol";
import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol";
import {ERC165Upgradeable} from "../utils/introspection/ERC165Upgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```solidity
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```solidity
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
 * to enforce additional security measures for this role.
 */
abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControl, ERC165Upgradeable {
    struct RoleData {
        mapping(address account => bool) hasRole;
        bytes32 adminRole;
    }

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;


    /// @custom:storage-location erc7201:openzeppelin.storage.AccessControl
    struct AccessControlStorage {
        mapping(bytes32 role => RoleData) _roles;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.AccessControl")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant AccessControlStorageLocation = 0x02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800;

    function _getAccessControlStorage() private pure returns (AccessControlStorage storage $) {
        assembly {
            $.slot := AccessControlStorageLocation
        }
    }

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with an {AccessControlUnauthorizedAccount} error including the required role.
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

    function __AccessControl_init() internal onlyInitializing {
    }

    function __AccessControl_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual returns (bool) {
        AccessControlStorage storage $ = _getAccessControlStorage();
        return $._roles[role].hasRole[account];
    }

    /**
     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`
     * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`
     * is missing `role`.
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert AccessControlUnauthorizedAccount(account, role);
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {
        AccessControlStorage storage $ = _getAccessControlStorage();
        return $._roles[role].adminRole;
    }

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

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

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

        _revokeRole(role, callerConfirmation);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        AccessControlStorage storage $ = _getAccessControlStorage();
        bytes32 previousAdminRole = getRoleAdmin(role);
        $._roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual returns (bool) {
        AccessControlStorage storage $ = _getAccessControlStorage();
        if (!hasRole(role, account)) {
            $._roles[role].hasRole[account] = true;
            emit RoleGranted(role, account, _msgSender());
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {
        AccessControlStorage storage $ = _getAccessControlStorage();
        if (hasRole(role, account)) {
            $._roles[role].hasRole[account] = false;
            emit RoleRevoked(role, account, _msgSender());
            return true;
        } else {
            return false;
        }
    }
}

File 21 of 42 : EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.

pragma solidity ^0.8.20;

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

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

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

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

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

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

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

                // Move the lastValue to the index where the value to delete is
                set._values[valueIndex] = lastValue;
                // Update the tracked position of the lastValue (that was just moved)
                set._positions[lastValue] = position;
            }

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

            // Delete the tracked position for the deleted slot
            delete set._positions[value];

            return true;
        } else {
            return false;
        }
    }

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

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

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

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

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

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

        assembly ("memory-safe") {
            result := store
        }

        return result;
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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

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

        assembly ("memory-safe") {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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

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

        assembly ("memory-safe") {
            result := store
        }

        return result;
    }
}

File 22 of 42 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.20;

/**
 * @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 Storage of the initializable contract.
     *
     * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions
     * when using with upgradeable contracts.
     *
     * @custom:storage-location erc7201:openzeppelin.storage.Initializable
     */
    struct InitializableStorage {
        /**
         * @dev Indicates that the contract has been initialized.
         */
        uint64 _initialized;
        /**
         * @dev Indicates that the contract is in the process of being initialized.
         */
        bool _initializing;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;

    /**
     * @dev The contract is already initialized.
     */
    error InvalidInitialization();

    /**
     * @dev The contract is not initializing.
     */
    error NotInitializing();

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint64 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 in the context of a constructor an `initializer` may be invoked any
     * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
     * production.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        // Cache values to avoid duplicated sloads
        bool isTopLevelCall = !$._initializing;
        uint64 initialized = $._initialized;

        // Allowed calls:
        // - initialSetup: the contract is not in the initializing state and no previous version was
        //                 initialized
        // - construction: the contract is initialized at version 1 (no reininitialization) and the
        //                 current contract is just being deployed
        bool initialSetup = initialized == 0 && isTopLevelCall;
        bool construction = initialized == 1 && address(this).code.length == 0;

        if (!initialSetup && !construction) {
            revert InvalidInitialization();
        }
        $._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 2**64 - 1 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint64 version) {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing || $._initialized >= version) {
            revert InvalidInitialization();
        }
        $._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() {
        _checkInitializing();
        _;
    }

    /**
     * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
     */
    function _checkInitializing() internal view virtual {
        if (!_isInitializing()) {
            revert NotInitializing();
        }
    }

    /**
     * @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 {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing) {
            revert InvalidInitialization();
        }
        if ($._initialized != type(uint64).max) {
            $._initialized = type(uint64).max;
            emit Initialized(type(uint64).max);
        }
    }

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

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

    /**
     * @dev Returns a pointer to the storage namespace.
     */
    // solhint-disable-next-line var-name-mixedcase
    function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
        assembly {
            $.slot := INITIALIZABLE_STORAGE
        }
    }
}

File 23 of 42 : IShadowV3PoolImmutables.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Pool state that never changes
/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values
interface IShadowV3PoolImmutables {
    /// @notice The contract that deployed the pool, which must adhere to the IShadowV3Factory interface
    /// @return The contract address
    function factory() external view returns (address);

    /// @notice The first of the two tokens of the pool, sorted by address
    /// @return The token contract address
    function token0() external view returns (address);

    /// @notice The second of the two tokens of the pool, sorted by address
    /// @return The token contract address
    function token1() external view returns (address);

    /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6
    /// @return The fee
    function fee() external view returns (uint24);

    /// @notice The pool tick spacing
    /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive
    /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...
    /// This value is an int24 to avoid casting even though it is always positive.
    /// @return The tick spacing
    function tickSpacing() external view returns (int24);

    /// @notice The maximum amount of position liquidity that can use any tick in the range
    /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and
    /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool
    /// @return The max amount of liquidity per tick
    function maxLiquidityPerTick() external view returns (uint128);
}

File 24 of 42 : IShadowV3PoolState.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Pool state that can change
/// @notice These methods compose the pool's state, and can change with any frequency including multiple times
/// per transaction
interface IShadowV3PoolState {
    /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas
    /// when accessed externally.
    /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value
    /// @return tick The current tick of the pool, i.e. according to the last tick transition that was run.
    /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick
    /// boundary.
    /// @return observationIndex The index of the last oracle observation that was written,
    /// @return observationCardinality The current maximum number of observations stored in the pool,
    /// @return observationCardinalityNext The next maximum number of observations, to be updated when the observation.
    /// @return feeProtocol The protocol fee for both tokens of the pool.
    /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0
    /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.
    /// unlocked Whether the pool is currently locked to reentrancy
    function slot0()
        external
        view
        returns (
            uint160 sqrtPriceX96,
            int24 tick,
            uint16 observationIndex,
            uint16 observationCardinality,
            uint16 observationCardinalityNext,
            uint8 feeProtocol,
            bool unlocked
        );

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

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

    /// @notice The amounts of token0 and token1 that are owed to the protocol
    /// @dev Protocol fees will never exceed uint128 max in either token
    function protocolFees() external view returns (uint128 token0, uint128 token1);

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

    /// @notice Look up information about a specific tick in the pool
    /// @param tick The tick to look up
    /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or
    /// tick upper
    /// @return liquidityNet how much liquidity changes when the pool price crosses the tick,
    /// @return feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,
    /// @return feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,
    /// @return tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick
    /// @return secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,
    /// @return secondsOutside the seconds spent on the other side of the tick from the current tick,
    /// @return initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.
    /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.
    /// In addition, these values are only relative and must be used only in comparison to previous snapshots for
    /// a specific position.
    function ticks(
        int24 tick
    )
        external
        view
        returns (
            uint128 liquidityGross,
            int128 liquidityNet,
            uint256 feeGrowthOutside0X128,
            uint256 feeGrowthOutside1X128,
            int56 tickCumulativeOutside,
            uint160 secondsPerLiquidityOutsideX128,
            uint32 secondsOutside,
            bool initialized
        );

    /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information
    function tickBitmap(int16 wordPosition) external view returns (uint256);

    /// @notice Returns the information about a position by the position's key
    /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper
    /// @return liquidity The amount of liquidity in the position,
    /// @return feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,
    /// @return feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,
    /// @return tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,
    /// @return tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke
    function positions(
        bytes32 key
    )
        external
        view
        returns (
            uint128 liquidity,
            uint256 feeGrowthInside0LastX128,
            uint256 feeGrowthInside1LastX128,
            uint128 tokensOwed0,
            uint128 tokensOwed1
        );

    /// @notice Returns data about a specific observation index
    /// @param index The element of the observations array to fetch
    /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time
    /// ago, rather than at a specific index in the array.
    /// @return blockTimestamp The timestamp of the observation,
    /// @return tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,
    /// @return secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,
    /// @return initialized whether the observation has been initialized and the values are safe to use
    function observations(
        uint256 index
    )
        external
        view
        returns (
            uint32 blockTimestamp,
            int56 tickCumulative,
            uint160 secondsPerLiquidityCumulativeX128,
            bool initialized
        );


    /// @notice get the period seconds in range of a specific position
    /// @param period the period number
    /// @param owner owner address
    /// @param index position index
    /// @param tickLower lower bound of range
    /// @param tickUpper upper bound of range
    /// @return periodSecondsInsideX96 seconds the position was not in range for the period
    function positionPeriodSecondsInRange(
        uint256 period,
        address owner,
        uint256 index,
        int24 tickLower,
        int24 tickUpper
    ) external view returns (uint256 periodSecondsInsideX96);
}

File 25 of 42 : IShadowV3PoolDerivedState.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Pool state that is not stored
/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the
/// blockchain. The functions here may have variable gas costs.
interface IShadowV3PoolDerivedState {
    /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp
    /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing
    /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,
    /// you must call it with secondsAgos = [3600, 0].
    /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in
    /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.
    /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned
    /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp
    /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block
    /// timestamp
    function observe(
        uint32[] calldata secondsAgos
    ) external view returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);

    /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range
    /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.
    /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first
    /// snapshot is taken and the second snapshot is taken.
    /// @param tickLower The lower tick of the range
    /// @param tickUpper The upper tick of the range
    /// @return tickCumulativeInside The snapshot of the tick accumulator for the range
    /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range
    /// @return secondsInside The snapshot of seconds per liquidity for the range
    function snapshotCumulativesInside(
        int24 tickLower,
        int24 tickUpper
    ) external view returns (int56 tickCumulativeInside, uint160 secondsPerLiquidityInsideX128, uint32 secondsInside);
}

File 26 of 42 : IShadowV3PoolActions.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Permissionless pool actions
/// @notice Contains pool methods that can be called by anyone
interface IShadowV3PoolActions {
    /// @notice Sets the initial price for the pool
    /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value
    /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96
    function initialize(uint160 sqrtPriceX96) external;

    /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position
    /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback
    /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends
    /// on tickLower, tickUpper, the amount of liquidity, and the current price.
    /// @param recipient The address for which the liquidity will be created
    /// @param index The index for which the liquidity will be created
    /// @param tickLower The lower tick of the position in which to add liquidity
    /// @param tickUpper The upper tick of the position in which to add liquidity
    /// @param amount The amount of liquidity to mint
    /// @param data Any data that should be passed through to the callback
    /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback
    /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback
    function mint(
        address recipient,
        uint256 index,
        int24 tickLower,
        int24 tickUpper,
        uint128 amount,
        bytes calldata data
    ) external returns (uint256 amount0, uint256 amount1);

    /// @notice Collects tokens owed to a position
    /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.
    /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or
    /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the
    /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.
    /// @param recipient The address which should receive the fees collected
    /// @param index The index of the position to be collected
    /// @param tickLower The lower tick of the position for which to collect fees
    /// @param tickUpper The upper tick of the position for which to collect fees
    /// @param amount0Requested How much token0 should be withdrawn from the fees owed
    /// @param amount1Requested How much token1 should be withdrawn from the fees owed
    /// @return amount0 The amount of fees collected in token0
    /// @return amount1 The amount of fees collected in token1
    function collect(
        address recipient,
        uint256 index,
        int24 tickLower,
        int24 tickUpper,
        uint128 amount0Requested,
        uint128 amount1Requested
    ) external returns (uint128 amount0, uint128 amount1);

    /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position
    /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0
    /// @dev Fees must be collected separately via a call to #collect
    /// @param index The index for which the liquidity will be burned
    /// @param tickLower The lower tick of the position for which to burn liquidity
    /// @param tickUpper The upper tick of the position for which to burn liquidity
    /// @param amount How much liquidity to burn
    /// @return amount0 The amount of token0 sent to the recipient
    /// @return amount1 The amount of token1 sent to the recipient
    function burn(
        uint256 index,
        int24 tickLower,
        int24 tickUpper,
        uint128 amount
    ) external returns (uint256 amount0, uint256 amount1);

    /// @notice Swap token0 for token1, or token1 for token0
    /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback
    /// @param recipient The address to receive the output of the swap
    /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0
    /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)
    /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this
    /// value after the swap. If one for zero, the price cannot be greater than this value after the swap
    /// @param data Any data to be passed through to the callback
    /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive
    /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive
    function swap(
        address recipient,
        bool zeroForOne,
        int256 amountSpecified,
        uint160 sqrtPriceLimitX96,
        bytes calldata data
    ) external returns (int256 amount0, int256 amount1);

    
    /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback
    /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback
    /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling
    /// with 0 amount{0,1} and sending the donation amount(s) from the callback
    /// @param recipient The address which will receive the token0 and token1 amounts
    /// @param amount0 The amount of token0 to send
    /// @param amount1 The amount of token1 to send
    /// @param data Any data to be passed through to the callback
    function flash(
        address recipient,
        uint256 amount0,
        uint256 amount1,
        bytes calldata data
    ) external;
    

    /// @notice Increase the maximum number of price and liquidity observations that this pool will store
    /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to
    /// the input observationCardinalityNext.
    /// @param observationCardinalityNext The desired minimum number of observations for the pool to store
    function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;
}

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

/// @title Permissioned pool actions
/// @notice Contains pool methods that may only be called by the factory owner
interface IShadowV3PoolOwnerActions {
    /// @notice Set the denominator of the protocol's % share of the fees
    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;
}

File 28 of 42 : IShadowV3PoolErrors.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Errors emitted by a pool
/// @notice Contains all events emitted by the pool
interface IShadowV3PoolErrors {
    error LOK();
    error TLU();
    error TLM();
    error TUM();
    error AI();
    error M0();
    error M1();
    error AS();
    error IIA();
    error L();
    error F0();
    error F1();
    error SPL();
}

File 29 of 42 : IShadowV3PoolEvents.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Events emitted by a pool
/// @notice Contains all events emitted by the pool
interface IShadowV3PoolEvents {
    /// @notice Emitted exactly once by a pool when #initialize is first called on the pool
    /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize
    /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96
    /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool
    event Initialize(uint160 sqrtPriceX96, int24 tick);

    /// @notice Emitted when liquidity is minted for a given position
    /// @param sender The address that minted the liquidity
    /// @param owner The owner of the position and recipient of any minted liquidity
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param amount The amount of liquidity minted to the position range
    /// @param amount0 How much token0 was required for the minted liquidity
    /// @param amount1 How much token1 was required for the minted liquidity
    event Mint(
        address sender,
        address indexed owner,
        int24 indexed tickLower,
        int24 indexed tickUpper,
        uint128 amount,
        uint256 amount0,
        uint256 amount1
    );

    /// @notice Emitted when fees are collected by the owner of a position
    /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees
    /// @param owner The owner of the position for which fees are collected
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param amount0 The amount of token0 fees collected
    /// @param amount1 The amount of token1 fees collected
    event Collect(
        address indexed owner,
        address recipient,
        int24 indexed tickLower,
        int24 indexed tickUpper,
        uint128 amount0,
        uint128 amount1
    );

    /// @notice Emitted when a position's liquidity is removed
    /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect
    /// @param owner The owner of the position for which liquidity is removed
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param amount The amount of liquidity to remove
    /// @param amount0 The amount of token0 withdrawn
    /// @param amount1 The amount of token1 withdrawn
    event Burn(
        address indexed owner,
        int24 indexed tickLower,
        int24 indexed tickUpper,
        uint128 amount,
        uint256 amount0,
        uint256 amount1
    );

    /// @notice Emitted by the pool for any swaps between token0 and token1
    /// @param sender The address that initiated the swap call, and that received the callback
    /// @param recipient The address that received the output of the swap
    /// @param amount0 The delta of the token0 balance of the pool
    /// @param amount1 The delta of the token1 balance of the pool
    /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96
    /// @param liquidity The liquidity of the pool after the swap
    /// @param tick The log base 1.0001 of price of the pool after the swap
    event Swap(
        address indexed sender,
        address indexed recipient,
        int256 amount0,
        int256 amount1,
        uint160 sqrtPriceX96,
        uint128 liquidity,
        int24 tick
    );

    /// @notice Emitted by the pool for any flashes of token0/token1
    /// @param sender The address that initiated the swap call, and that received the callback
    /// @param recipient The address that received the tokens from flash
    /// @param amount0 The amount of token0 that was flashed
    /// @param amount1 The amount of token1 that was flashed
    /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee
    /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee
    event Flash(
        address indexed sender,
        address indexed recipient,
        uint256 amount0,
        uint256 amount1,
        uint256 paid0,
        uint256 paid1
    );

    /// @notice Emitted by the pool for increases to the number of observations that can be stored
    /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index
    /// just before a mint/swap/burn.
    /// @param observationCardinalityNextOld The previous value of the next observation cardinality
    /// @param observationCardinalityNextNew The updated value of the next observation cardinality
    event IncreaseObservationCardinalityNext(
        uint16 observationCardinalityNextOld, uint16 observationCardinalityNextNew
    );

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

    /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner
    /// @param sender The address that collects the protocol fees
    /// @param recipient The address that receives the collected protocol fees
    /// @param amount0 The amount of token0 protocol fees that is withdrawn
    /// @param amount0 The amount of token1 protocol fees that is withdrawn
    event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);
}

File 30 of 42 : IPoolInitializer.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;
pragma abicoder v2;

/// @title Creates and initializes V3 Pools
/// @notice Provides a method for creating and initializing a pool, if necessary, for bundling with other methods that
/// require the pool to exist.
interface IPoolInitializer {
    /// @notice Creates a new pool if it does not exist, then initializes if not initialized
    /// @dev This method can be bundled with others via IMulticall for the first action (e.g. mint) performed against a pool
    /// @param token0 The contract address of token0 of the pool
    /// @param token1 The contract address of token1 of the pool
    /// @param tickSpacing The tickSpacing 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,
        int24 tickSpacing,
        uint160 sqrtPriceX96
    ) external payable returns (address pool);
}

File 31 of 42 : IPeripheryPayments.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;

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

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

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

File 32 of 42 : IPeripheryImmutableState.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

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

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

File 33 of 42 : PoolAddress.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Provides functions for deriving a pool address from the deployer, tokens, and the fee
library PoolAddress {
    bytes32 internal constant POOL_INIT_CODE_HASH = 0xc701ee63862761c31d620a4a083c61bdc1e81761e6b9c9267fd19afd22e0821d;

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

    /// @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 tickSpacing The tickSpacing of the pool
    /// @return Poolkey The pool details with ordered token0 and token1 assignments
    function getPoolKey(address tokenA, address tokenB, int24 tickSpacing) internal pure returns (PoolKey memory) {
        if (tokenA > tokenB) (tokenA, tokenB) = (tokenB, tokenA);
        return PoolKey({token0: tokenA, token1: tokenB, tickSpacing: tickSpacing});
    }

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

File 34 of 42 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.20;

import {IERC165} from "../../utils/introspection/IERC165.sol";

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

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

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

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

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

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

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC-721 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 ERC-721
     * 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 address zero.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool approved) external;

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

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

File 35 of 42 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.20;

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

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

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

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

File 36 of 42 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/IERC721Enumerable.sol)

pragma solidity ^0.8.20;

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

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

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

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

File 37 of 42 : IPeripheryErrors.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Errors emitted by the NonFungiblePositionManager
/// @notice Contains all events emitted by the NfpManager
interface IPeripheryErrors {
    error InvalidTokenId(uint256 tokenId);
    error CheckSlippage();
    error NotCleared();
}

File 38 of 42 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

File 39 of 42 : IAccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (access/IAccessControl.sol)

pragma solidity ^0.8.20;

/**
 * @dev External interface of AccessControl declared to support ERC-165 detection.
 */
interface IAccessControl {
    /**
     * @dev The `account` is missing a role.
     */
    error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);

    /**
     * @dev The caller of a function is not the expected one.
     *
     * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.
     */
    error AccessControlBadConfirmation();

    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call. This account bears the admin role (for the granted role).
     * Expected in cases where the role was granted using the internal {AccessControl-_grantRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

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

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

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

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

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

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

File 40 of 42 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

File 41 of 42 : ERC165Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/ERC165.sol)

pragma solidity ^0.8.20;

import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import {Initializable} from "../../proxy/utils/Initializable.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC-165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 */
abstract contract ERC165Upgradeable is Initializable, IERC165 {
    function __ERC165_init() internal onlyInitializing {
    }

    function __ERC165_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

File 42 of 42 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

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

Settings
{
  "remappings": [
    "@openzeppelin-contracts-5.1.0/=dependencies/@openzeppelin-contracts-5.1.0/",
    "@openzeppelin-contracts-upgradeable-5.1.0/=dependencies/@openzeppelin-contracts-upgradeable-5.1.0/",
    "@forge-std-1.9.4/=dependencies/forge-std-1.9.4/",
    "@layerzerolabs/=node_modules/@layerzerolabs/",
    "@layerzerolabs/lz-evm-protocol-v2/=node_modules/@layerzerolabs/lz-evm-protocol-v2/",
    "@openzeppelin-contracts-upgradeable/=dependencies/@openzeppelin-contracts-upgradeable-5.1.0/",
    "@openzeppelin-contracts/contracts/=dependencies/@openzeppelin-contracts-5.1.0/",
    "@openzeppelin/contracts/=dependencies/@openzeppelin-contracts-5.1.0/",
    "erc4626-tests/=dependencies/erc4626-property-tests-1.0/",
    "forge-std/=dependencies/forge-std-1.9.4/src/",
    "permit2/=lib/permit2/",
    "@openzeppelin-3.4.2/=node_modules/@openzeppelin-3.4.2/",
    "@openzeppelin-contracts-5.1.0/=dependencies/@openzeppelin-contracts-5.1.0/",
    "@openzeppelin-contracts-upgradeable-5.1.0/=dependencies/@openzeppelin-contracts-upgradeable-5.1.0/",
    "@uniswap/=node_modules/@uniswap/",
    "base64-sol/=node_modules/base64-sol/",
    "ds-test/=node_modules/ds-test/",
    "erc4626-property-tests-1.0/=dependencies/erc4626-property-tests-1.0/",
    "eth-gas-reporter/=node_modules/eth-gas-reporter/",
    "forge-std-1.9.4/=dependencies/forge-std-1.9.4/src/",
    "hardhat/=node_modules/hardhat/",
    "solidity-bytes-utils/=node_modules/solidity-bytes-utils/",
    "solmate/=node_modules/solmate/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 1633
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "cancun",
  "viaIR": true,
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"KICK_FORBIDDEN","type":"error"},{"inputs":[],"name":"LENGTH_MISMATCH","type":"error"},{"inputs":[{"internalType":"bytes","name":"","type":"bytes"}],"name":"MANUAL_EXECUTION_FAILURE","type":"error"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"NOT_TIMELOCK","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[],"name":"SAME_ADDRESS","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PROTOCOL_OPERATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SWAP_FEE_SETTER","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_pools","type":"address[]"},{"internalType":"address[]","name":"_rewards","type":"address[]"},{"internalType":"bool[]","name":"_addReward","type":"bool[]"}],"name":"augmentGaugeRewardsForPair","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"backupDistribute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"startIndex","type":"uint256"},{"internalType":"uint256","name":"batchSize","type":"uint256"}],"name":"backupDistributeBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"clGaugeFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_pool","type":"address"}],"name":"createGaugeForPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_pool","type":"address"}],"name":"disablePoolInLauncherPlugin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_pool","type":"address"}],"name":"enablePoolInLauncherPlugin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int24","name":"tickSpacing","type":"int24"},{"internalType":"uint24","name":"initialFee","type":"uint24"}],"name":"enableTickSpacing","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_target","type":"address"},{"internalType":"bytes","name":"_payload","type":"bytes"}],"name":"execute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feeCollector","outputs":[{"internalType":"contract IFeeCollector","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeDistributorFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeRecipientFactory","outputs":[{"internalType":"contract IFeeRecipientFactory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gaugeFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMembers","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_token","type":"address[]"},{"internalType":"bool[]","name":"_whitelisted","type":"bool[]"}],"name":"governanceWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newAuthority","type":"address"},{"internalType":"string","name":"_label","type":"string"}],"name":"grantAuthorityInLauncherPlugin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"timelock","type":"address"},{"internalType":"address","name":"treasury","type":"address"},{"internalType":"address","name":"voter","type":"address"},{"internalType":"address","name":"minter","type":"address"},{"internalType":"address","name":"launcherPlugin","type":"address"},{"internalType":"address","name":"xShadow","type":"address"},{"internalType":"address","name":"x33","type":"address"},{"internalType":"address","name":"shadowV3PoolFactory","type":"address"},{"internalType":"address","name":"poolFactory","type":"address"},{"internalType":"address","name":"clGaugeFactory","type":"address"},{"internalType":"address","name":"gaugeFactory","type":"address"},{"internalType":"address","name":"feeRecipientFactory","type":"address"},{"internalType":"address","name":"feeDistributorFactory","type":"address"},{"internalType":"address","name":"feeCollector","type":"address"},{"internalType":"address","name":"voteModule","type":"address"}],"internalType":"struct IAccessHub.InitParams","name":"params","type":"tuple"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_shadow","type":"address"},{"internalType":"address","name":"_legacyFactory","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":"_xShadow","type":"address"},{"internalType":"address","name":"_clFactory","type":"address"},{"internalType":"address","name":"_clGaugeFactory","type":"address"},{"internalType":"address","name":"_nfpManager","type":"address"},{"internalType":"address","name":"_feeRecipientFactory","type":"address"},{"internalType":"address","name":"_voteModule","type":"address"},{"internalType":"address","name":"_launcherPlugin","type":"address"}],"name":"initializeVoter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_nonparticipants","type":"address[]"}],"name":"kickInactive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_pairs","type":"address[]"}],"name":"killGauge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_authority","type":"address"},{"internalType":"string","name":"_label","type":"string"}],"name":"labelAuthorityInLauncherPlugin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"launcherPlugin","outputs":[{"internalType":"contract ILauncherPlugin","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"}],"name":"migrateOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_oldPool","type":"address"},{"internalType":"address","name":"_newPool","type":"address"}],"name":"migratePoolInLauncherPlugin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"minter","outputs":[{"internalType":"contract IMinter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nfpManager","outputs":[{"internalType":"contract INonfungiblePositionManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"pools","type":"address[]"},{"internalType":"uint256[]","name":"emissions","type":"uint256[]"}],"name":"notifyEmissions","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"operatorRedeemXShadow","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"poolFactory","outputs":[{"internalType":"contract IPairFactory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"timelock","type":"address"},{"internalType":"address","name":"treasury","type":"address"},{"internalType":"address","name":"voter","type":"address"},{"internalType":"address","name":"minter","type":"address"},{"internalType":"address","name":"launcherPlugin","type":"address"},{"internalType":"address","name":"xShadow","type":"address"},{"internalType":"address","name":"x33","type":"address"},{"internalType":"address","name":"shadowV3PoolFactory","type":"address"},{"internalType":"address","name":"poolFactory","type":"address"},{"internalType":"address","name":"clGaugeFactory","type":"address"},{"internalType":"address","name":"gaugeFactory","type":"address"},{"internalType":"address","name":"feeRecipientFactory","type":"address"},{"internalType":"address","name":"feeDistributorFactory","type":"address"},{"internalType":"address","name":"feeCollector","type":"address"},{"internalType":"address","name":"voteModule","type":"address"}],"internalType":"struct IAccessHub.InitParams","name":"params","type":"tuple"}],"name":"reinit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_pools","type":"address[]"},{"internalType":"address[]","name":"_rewards","type":"address[]"}],"name":"removeFeeDistributorRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"rescue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"rescueFromX33","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_tokens","type":"address[]"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"}],"name":"rescueTrappedTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"resetVotesOnBehalfOf","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"},{"internalType":"uint256","name":"_period","type":"uint256"}],"name":"retrieveStuckEmissionsToGovernance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_pairs","type":"address[]"}],"name":"reviveGauge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_oldAuthority","type":"address"}],"name":"revokeAuthorityInLauncherPlugin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_pool","type":"address"},{"internalType":"uint256","name":"_take","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"}],"name":"setConfigsInLauncherPlugin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_candidates","type":"address[]"},{"internalType":"bool[]","name":"_exempt","type":"bool[]"}],"name":"setCooldownExemption","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_multiplier","type":"uint256"}],"name":"setEmissionsMultiplierInMinter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pct","type":"uint256"}],"name":"setEmissionsRatioInVoter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newFeeCollector","type":"address"}],"name":"setFeeCollectorInFactoryV3","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_pools","type":"address[]"},{"internalType":"uint8[]","name":"_feeProtocol","type":"uint8[]"}],"name":"setFeeSplitCL","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_pools","type":"address[]"},{"internalType":"uint256[]","name":"_feeSplits","type":"uint256[]"}],"name":"setFeeSplitLegacy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"status","type":"bool"}],"name":"setFeeSplitWhenNoGauge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_feeToTreasury","type":"uint256"}],"name":"setFeeToTreasuryInFeeRecipientFactory","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"_feeProtocolGlobal","type":"uint8"}],"name":"setGlobalClFeeProtocol","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setLegacyFeeGlobal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_feeSplit","type":"uint256"}],"name":"setLegacyFeeSplitGlobal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"int24","name":"tickSpacing","type":"int24"}],"name":"setMainTickSpacingInVoter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newGovernor","type":"address"}],"name":"setNewGovernorInVoter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newDuration","type":"uint256"}],"name":"setNewRebaseStreamingDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_timelock","type":"address"}],"name":"setNewTimelock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newCooldown","type":"uint256"}],"name":"setNewVoteModuleCooldown","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newOperator","type":"address"}],"name":"setOperatorInLauncherPlugin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_pair","type":"address"},{"internalType":"bool","name":"_status","type":"bool"}],"name":"setSkimEnabledLegacy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_pools","type":"address[]"},{"internalType":"uint24[]","name":"_swapFees","type":"uint24[]"},{"internalType":"bool[]","name":"_concentrated","type":"bool[]"}],"name":"setSwapFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_treasuryFees","type":"uint256"}],"name":"setTreasuryFeesInFeeCollector","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newTreasury","type":"address"}],"name":"setTreasuryInFeeCollector","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_treasury","type":"address"}],"name":"setTreasuryInFeeRecipientFactory","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_treasury","type":"address"}],"name":"setTreasuryInLegacyFactory","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_voter","type":"address"}],"name":"setVoterAddressInFactoryV3","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"shadowV3PoolFactory","outputs":[{"internalType":"contract IShadowV3Factory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"timelock","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"enable","type":"bool"}],"name":"toggleXShadowGovernance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newOperator","type":"address"}],"name":"transferOperatorInX33","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_who","type":"address[]"},{"internalType":"bool[]","name":"_whitelisted","type":"bool[]"}],"name":"transferToWhitelistInXShadow","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_who","type":"address[]"},{"internalType":"bool[]","name":"_whitelisted","type":"bool[]"}],"name":"transferWhitelistInXShadow","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"voteModule","outputs":[{"internalType":"contract IVoteModule","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"voter","outputs":[{"internalType":"contract IVoter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"x33","outputs":[{"internalType":"contract IX33","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"xShadow","outputs":[{"internalType":"contract IXShadow","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

6080806040523460aa575f516020615bf65f395f51905f525460ff8160401c16609b576002600160401b03196001600160401b038216016049575b604051615b4790816100af8239f35b6001600160401b0319166001600160401b039081175f516020615bf65f395f51905f525581527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d290602090a15f80603a565b63f92ee8a960e01b5f5260045ffd5b5f80fdfe60806040526004361015610011575f80fd5b5f3560e01c80620c07c714614be757806301ffc9a714614b1357806302be9a9014614a845780630754617214614a5e57806307a8d4ef14614895578063083eebfc1461482657806309651f7d1461468a5780630c2e061f146146215780630d52333c146145fb578063163588061461457a5780631869c94a146143945780631cff79cd146142bd5780631eadbd8b1461422d578063248a9ca3146141db5780632a59c8061461416a5780632eb64795146140eb5780632f2ff15d1461408e578063360e16de14613fed57806336568abe14613f905780633abdbf2a14613f1e5780633eadd56e14613ead5780634135afbe14613e1e5780634219dc4014613df8578063421f2aae146137f45780634256f5e7146137ce5780634345f59a1461370857806346c96aac146136e257806349fe8228146136615780634b9880c1146135e25780634cb4d827146135285780634d4ce1c11461347b57806352e0970f146134135780635cb62a08146133a257806361d027b31461337c5780636379808f146132fb578063687b01351461328a57806369e0bc05146130ce5780636e57f00e1461304d578063750520781461290e57806378b1a8c7146128d45780637a707730146128635780637bebe3811461283d5780637c972e2e146124ae5780638019b6b714611d1757806380a1ebbb14611c4557806382169aec14611af8578063839006f214611a0557806385caf28b146119df5780638cb422f0146119a55780639010d07c1461194257806390291058146118c757806390bcc5a21461167957806391742be01461160a57806391d14854146115a157806393208a2b1461157b5780639647d1411461155557806398bbc3c71461152f5780639987e757146114ae5780639a17759b146114885780639e3dc42d14611176578063a217fddf1461115c578063a3246ad31461108e578063a56bcb4c1461100c578063a71504ad14610f9b578063ab0e019214610f33578063b7923cd014610eca578063ba01351014610e59578063bb511b5e14610de3578063be02ec3814610c24578063beb7dc3414610b5f578063c1463c1514610ac5578063c415b95c14610a9f578063c5f720e414610a79578063c9d068fd14610a11578063ca15c873146109c8578063ca1699e8146107a1578063ca62573a14610722578063d32af6c1146106fc578063d33219b4146106d7578063d547741f14610675578063dbb466df146105e9578063e6dca2b214610568578063e95245fd146104e7578063eee0fdb4146104535763f7553c52146103bf575f80fd5b3461044f576103cd36614f8c565b6103d8929192615409565b6001600160a01b0360075416803b1561044f57610428935f8094604051968795869485937f2cd21e00000000000000000000000000000000000000000000000000000000008552600485016153e6565b03925af180156104445761043857005b5f61044291614fff565b005b6040513d5f823e3d90fd5b5f80fd5b3461044f57604036600319011261044f576004358060020b80910361044f576024359062ffffff821680920361044f5761048b615409565b6001600160a01b03600a541691823b1561044f5760445f928360405195869485937feee0fdb4000000000000000000000000000000000000000000000000000000008552600485015260248401525af180156104445761043857005b3461044f57602036600319011261044f57610500614e87565b610508615409565b6001600160a01b036007541690813b1561044f576001600160a01b0360245f928360405195869485937fb3ab15fb0000000000000000000000000000000000000000000000000000000085521660048401525af180156104445761043857005b3461044f57602036600319011261044f57610581614e87565b610589615409565b6001600160a01b036007541690813b1561044f576001600160a01b0360245f928360405195869485937fdcaaa61b0000000000000000000000000000000000000000000000000000000085521660048401525af180156104445761043857005b3461044f57604036600319011261044f57610602614e87565b61060a614e9d565b90610613615409565b6001600160a01b036007541691823b1561044f576040517f772b7e970000000000000000000000000000000000000000000000000000000081526001600160a01b03928316600482015291166024820152905f90829081838160448101610428565b3461044f57604036600319011261044f57610442600435610694614e9d565b906106d26106cd825f527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602052600160405f20015490565b6154e7565b61559e565b3461044f575f36600319011261044f5760206001600160a01b035f5416604051908152f35b3461044f575f36600319011261044f5760206001600160a01b03600c5416604051908152f35b3461044f57602036600319011261044f5760043560ff811680910361044f57610749615409565b6001600160a01b03600a541690813b1561044f575f916024839260405194859384927fb613a14100000000000000000000000000000000000000000000000000000000845260048401525af180156104445761043857005b3461044f576107af36614f1b565b6107bb95919395615409565b828514806109bf575b15610997575f5b8581106107d457005b6001600160a01b0360055416906107f46107ef828987615021565b615196565b916001600160a01b03604051936302045be960e41b8552166004840152602083602481845afa928315610444575f9361095c575b5061083c61083783868a615021565b615320565b156108d657506001600160a01b03600554169161085d6107ef83888c615021565b833b1561044f576040517fd36f07280000000000000000000000000000000000000000000000000000000081526001600160a01b03928316600482015291166024820152915f908390604490829084905af1918215610444576001926108c6575b505b016107cb565b5f6108d091614fff565b886108be565b916108e56107ef83888c615021565b833b1561044f576040517fffc0a01e0000000000000000000000000000000000000000000000000000000081526001600160a01b03928316600482015291166024820152915f908390604490829084905af19182156104445760019261094c575b506108c0565b5f61095691614fff565b88610946565b9092506020813d821161098f575b8161097760209383614fff565b8101031261044f57610988906151c2565b9189610828565b3d915061096a565b7f899ef10d000000000000000000000000000000000000000000000000000000005f5260045ffd5b508083146107c4565b3461044f57602036600319011261044f576004355f527fc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e82371705932000602052602060405f2054604051908152f35b3461044f57602036600319011261044f57610a2a614e87565b610a32615409565b6001600160a01b03600b541690813b1561044f576001600160a01b0360245f92836040519586948593630787a21360e51b85521660048401525af180156104445761043857005b3461044f575f36600319011261044f5760206001600160a01b0360095416604051908152f35b3461044f575f36600319011261044f5760206001600160a01b03600d5416604051908152f35b3461044f57606036600319011261044f57610ade614e87565b610ae6614eb3565b90610aef615409565b6001600160a01b036007541690813b1561044f5760646001600160a01b03915f80948460405197889687957fd309dbc600000000000000000000000000000000000000000000000000000000875216600486015260243560248601521660448401525af180156104445761043857005b3461044f57610b6d36614ec9565b909192610b78615409565b6001600160a01b036008541690813b1561044f57610bc890604051957fbeb7dc34000000000000000000000000000000000000000000000000000000008752604060048801526044870191615278565b848103600319016024860152828152917f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811161044f575f60208682968196829560051b809285830137010301925af180156104445761043857005b3461044f57602036600319011261044f5760043567ffffffffffffffff811161044f57610c55903690600401614e56565b90610c5e615409565b5f5b828110610c6957005b610c776107ef828585615021565b906001600160a01b0380600d5416921691803b1561044f575f8091602460405180948193632a54db0160e01b83528860048401525af1801561044457610dd3575b506001600160a01b03600554166040516302045be960e41b8152836004820152602081602481855afa908115610444575f91610d9a575b50813b1561044f576001600160a01b0360245f9283604051958694859363992a793360e01b85521660048401525af1801561044457610d8a575b506001600160a01b03600a541691823b1561044f575f92604484926040519586938492633b39a71f60e11b84526004840152600560248401525af191821561044457600192610d7a575b5001610c60565b5f610d8491614fff565b84610d73565b5f610d9491614fff565b84610d29565b90506020813d8211610dcb575b81610db460209383614fff565b8101031261044f57610dc5906151c2565b86610cef565b3d9150610da7565b5f610ddd91614fff565b84610cb8565b3461044f57602036600319011261044f57610dfc614e87565b610e12336001600160a01b035f5416331461523b565b6001600160a01b036005541690813b1561044f576001600160a01b0360245f92836040519586948593636b8ab97d60e01b85521660048401525af180156104445761043857005b3461044f57602036600319011261044f57610e72615409565b6001600160a01b0360055416803b1561044f575f80916024604051809481937f0f14763200000000000000000000000000000000000000000000000000000000835260043560048401525af180156104445761043857005b3461044f57610ed836614f8c565b610ee3929192615409565b6001600160a01b0360075416803b1561044f57610428935f8094604051968795869485937fc657c718000000000000000000000000000000000000000000000000000000008552600485016153e6565b3461044f57602036600319011261044f57610f4c614e87565b610f54615409565b6001600160a01b03600c541690813b1561044f576001600160a01b0360245f92836040519586948593630787a21360e51b85521660048401525af180156104445761043857005b3461044f57602036600319011261044f57610fb4615409565b6001600160a01b03600c5416803b1561044f575f80916024604051809481937f019494b300000000000000000000000000000000000000000000000000000000835260043560048401525af180156104445761043857005b3461044f57604036600319011261044f57611025614e87565b61102d615409565b6001600160a01b0360095416803b1561044f576040517f7a4e4ecf0000000000000000000000000000000000000000000000000000000081526001600160a01b03831660048201526024803590820152905f90829081838160448101610428565b3461044f57602036600319011261044f576004355f527fc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e8237170593200060205260405f20604051806020835491828152019081935f5260205f20905f5b81811061114657505050816110fb910382614fff565b604051918291602083019060208452518091526040830191905f5b818110611124575050500390f35b82516001600160a01b0316845285945060209384019390920191600101611116565b82548452602090930192600192830192016110e5565b3461044f575f36600319011261044f5760206040515f8152f35b3461044f57602036600319011261044f5761118f614e87565b611197615409565b6001600160a01b03602081600a5416926024604051809481937f42378e9500000000000000000000000000000000000000000000000000000000835216958660048301525afa908115610444575f91611459575b501561140857604051907f0dfe1681000000000000000000000000000000000000000000000000000000008252602082600481845afa918215610444575f926113cc575b50604051907fd21220a7000000000000000000000000000000000000000000000000000000008252602082600481845afa918215610444575f9261138d575b50906020600492604051938480927fd0c93a7c0000000000000000000000000000000000000000000000000000000082525afa918215610444575f9261134d575b506005546040517fd1cf58f20000000000000000000000000000000000000000000000000000000081526001600160a01b039485166004820152918416602483015260029290920b604482015291602091839116815f81606481015b03925af180156104445761131b57005b6020813d602011611345575b8161133460209383614fff565b8101031261044f57610442906151c2565b3d9150611327565b9091506020813d602011611385575b8161136960209383614fff565b8101031261044f5751908160020b820361044f5761130b6112af565b3d915061135c565b91506020823d6020116113c4575b816113a860209383614fff565b8101031261044f5760206113bd6004936151c2565b925061126e565b3d915061139b565b9091506020813d602011611400575b816113e860209383614fff565b8101031261044f576113f9906151c2565b908261122f565b3d91506113db565b60205f9160246001600160a01b03600554169160405194859384927fa5f4301e00000000000000000000000000000000000000000000000000000000845260048401525af180156104445761131b57005b61147b915060203d602011611481575b6114738183614fff565b81019061537c565b826111eb565b503d611469565b3461044f575f36600319011261044f5760206001600160a01b03600a5416604051908152f35b3461044f57602036600319011261044f576114c7614e87565b6114cf615409565b6001600160a01b036007541690813b1561044f576001600160a01b0360245f928360405195869485937f595aeb500000000000000000000000000000000000000000000000000000000085521660048401525af180156104445761043857005b3461044f575f36600319011261044f5760206001600160a01b03600f5416604051908152f35b3461044f575f36600319011261044f5760206001600160a01b0360045416604051908152f35b3461044f575f36600319011261044f5760206001600160a01b0360075416604051908152f35b3461044f57604036600319011261044f576115ba614e9d565b6004355f527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006020526001600160a01b0360405f2091165f52602052602060ff60405f2054166040519015158152f35b3461044f5761161836614ec9565b9291611622615409565b838103610997576001600160a01b036008541690813b1561044f575f8094610428604051978896879586947f94126bb1000000000000000000000000000000000000000000000000000000008652600486016152c5565b3461044f57602036600319011261044f5760043567ffffffffffffffff811161044f576116aa903690600401614e56565b906116b3615409565b5f5b8281106116be57005b6116cc6107ef828585615021565b906001600160a01b03600d54166001600160a01b03831690803b1561044f575f8091602460405180948193632a54db0160e01b83528760048401525af18015610444576118b7575b506001600160a01b036005541690604051906302045be960e41b82526004820152602081602481855afa908115610444575f9161187e575b50813b1561044f576001600160a01b0360245f92836040519586948593639f06247b60e01b85521660048401525af180156104445761186e575b506001600160a01b03600a5416916040517f527eb4bc000000000000000000000000000000000000000000000000000000008152602081600481875afa908115610444575f91611833575b50833b1561044f57604051633b39a71f60e11b81526001600160a01b0392909216600483015260ff166024820152915f908390604490829084905af191821561044457600192611823575b50016116b5565b5f61182d91614fff565b8461181c565b90506020813d8211611866575b8161184d60209383614fff565b8101031261044f575160ff8116810361044f57866117d1565b3d9150611840565b5f61187891614fff565b84611786565b90506020813d82116118af575b8161189860209383614fff565b8101031261044f576118a9906151c2565b8661174c565b3d915061188b565b5f6118c191614fff565b85611714565b3461044f57602036600319011261044f576118e0614ff0565b6118e8615409565b6001600160a01b03600b541690813b1561044f575f916024839260405194859384927f90291058000000000000000000000000000000000000000000000000000000008452151560048401525af180156104445761043857005b3461044f57604036600319011261044f576004355f527fc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e8237170593200060205260206001600160a01b0361199560243560405f206159c8565b90549060031b1c16604051908152f35b3461044f575f36600319011261044f5760206040517f0cee480c05aeabaa18fb824cd297ccabddb1b1a9a83b28d3f07e85c0cd25c4598152f35b3461044f575f36600319011261044f5760206001600160a01b03600e5416604051908152f35b3461044f57602036600319011261044f576001600160a01b03611a26614e87565b611a2e615409565b166001600160a01b0360015416604051906370a0823160e01b8252306004830152602082602481865afa918215610444575f92611ac2575b5060405163a9059cbb60e01b81526001600160a01b0390911660048201526024810191909152906020908290815f81604481015b03925af1801561044457611aaa57005b6104429060203d602011611481576114738183614fff565b91506020823d602011611af0575b81611add60209383614fff565b8101031261044f57905190611a9a611a66565b3d9150611ad0565b3461044f57611b0636614ec9565b9091611b10615409565b818103610997575f5b818110611b2257005b611b30610837828587615021565b15611bbe576001600160a01b036005541690611b506107ef828589615021565b823b1561044f576001600160a01b0360245f928360405196879485937f9b19251a0000000000000000000000000000000000000000000000000000000085521660048401525af191821561044457600192611bae575b505b01611b19565b5f611bb891614fff565b86611ba6565b6001600160a01b036005541690611bd96107ef828589615021565b823b1561044f576001600160a01b0360245f928360405196879485937f9c7f33150000000000000000000000000000000000000000000000000000000085521660048401525af191821561044457600192611c35575b50611ba8565b5f611c3f91614fff565b86611c2f565b3461044f57611c5336614ec9565b91611c6a336001600160a01b035f5416331461523b565b5f5b818110611c7557005b6001600160a01b03600e541690611c906107ef828589615021565b611c9e610837838888615021565b833b1561044f576040517fc717374a0000000000000000000000000000000000000000000000000000000081526001600160a01b0392909216600483015215156024820152915f908390604490829084905af191821561044457600192611d07575b5001611c6c565b5f611d1191614fff565b86611d00565b3461044f57604036600319011261044f57600435611d33615409565b6001600160a01b036008541690604051631e49236560e21b8152602081600481865afa8015610444576001600160a01b03915f9161247f575b501691604051635c975abb60e01b8152602081600481855afa908115610444575f91612460575b5015612426575b505f60206001600160a01b036006541660046040518094819363541b13ef60e11b83525af18015610444576123f7575b506001600160a01b03600554169160405190631ed2419560e01b8252602082600481875afa918215610444575f926123c3575b5060405193633251b17360e21b85525f85600481845afa948515610444575f95612383575b5060405190630880b70160e01b8252836004830152602082602481845afa918215610444575f9261234e575b5060206024916040519283809263a5a645c160e01b82528860048301525afa908115610444575f9161231c575b5060243585019485811161221d578651808711612314575b505b858110611e9e57005b6001600160a01b03600554166001600160a01b03611ebc838a615394565b5116604051906348e321c760e11b82526004820152602081602481855afa80156104445787915f916122e0575b50146122d7576040516370a0823160e01b8152816004820152602081602481895afa908115610444575f916122a6575b506001600160a01b03611f2c848b615394565b51166040519063036b50d960e11b82526004820152602081602481865afa80156104445788915f91612264575b5060405163346c440f60e01b81526001600160a01b039091166004820152602481019190915260208180604481015b0381865afa8015610444575f90612231575b611fa59150866153a8565b670de0b6b3a7640000810290808204670de0b6b3a7640000149015171561221d578490806122035750505f915b818311612190575b5050506001600160a01b03600554166001600160a01b03611ffb838a615394565b511660405190631703e5f960e01b82526004820152602081602481855afa908115610444575f91612172575b50156120fe57506001600160a01b03600554166001600160a01b0361204c838a615394565b5116813b1561044f575f9160248392604051948593849263992a793360e01b845260048401525af18015610444576120ee575b506001600160a01b0360055416906001600160a01b0361209f828a615394565b5116823b1561044f575f92602484926040519586938492639f06247b60e01b845260048401525af1918215610444576001926120de575b505b01611e95565b5f6120e891614fff565b886120d6565b5f6120f891614fff565b8761207f565b906001600160a01b03612111828a615394565b511691803b1561044f57604051635824780d60e01b81526001600160a01b03939093166004840152602483018790525f908390604490829084905af191821561044457600192612162575b506120d8565b5f61216c91614fff565b8861215c565b61218a915060203d8111611481576114738183614fff565b89612027565b61219f6020926121cd946153d9565b60405163a9059cbb60e01b81526001600160a01b039092166004830152602482015291829081906044820190565b03815f895af18015610444576121e5575b8080611fda565b6121fc9060203d8111611481576114738183614fff565b50876121de565b670de0b6b3a764000091612216916153bb565b0491611fd2565b634e487b7160e01b5f52601160045260245ffd5b506020813d821161225c575b8161224a60209383614fff565b8101031261044f57611fa59051611f9a565b3d915061223d565b9150506020813d821161229e575b8161227f60209383614fff565b8101031261044f57602088612296611f88936151c2565b915091611f59565b3d9150612272565b90506020813d82116122cf575b816122c060209383614fff565b8101031261044f575189611f19565b3d91506122b3565b506001906120d8565b9150506020813d821161230c575b816122fb60209383614fff565b8101031261044f578690518a611ee9565b3d91506122ee565b955087611e93565b90506020813d602011612346575b8161233760209383614fff565b8101031261044f575186611e7b565b3d915061232a565b9091506020813d60201161237b575b8161236a60209383614fff565b8101031261044f5751906020611e4e565b3d915061235d565b9094503d805f833e6123958183614fff565b810160208282031261044f57815167ffffffffffffffff811161044f576123bc92016151d6565b9385611e22565b9091506020813d6020116123ef575b816123df60209383614fff565b8101031261044f57519084611dfd565b3d91506123d2565b6020813d60201161241e575b8161241060209383614fff565b8101031261044f5751611dca565b3d9150612403565b803b1561044f575f8091600460405180948193638456cb5960e01b83525af180156104445715611d9a575f61245a91614fff565b82611d9a565b612479915060203d602011611481576114738183614fff565b84611d93565b6124a1915060203d6020116124a7575b6124998183614fff565b81019061535d565b84611d6c565b503d61248f565b3461044f576124bc36614ec9565b90926124c6615409565b6001600160a01b0360085416604051631e49236560e21b8152602081600481855afa8015610444576001600160a01b03915f9161281e575b5016906040516370a0823160e01b8152306004820152602081602481865afa908115610444575f916127ea575b5060405163095ea7b360e01b81526001600160a01b039092166004830152602482015260208180604481015b03815f865af18015610444576127cd575b50602460206001600160a01b036008541692604051928380926370a0823160e01b82523060048301525afa908115610444575f9161279b575b50813b1561044f575f916024839260405194859384927f12e8267400000000000000000000000000000000000000000000000000000000845260048401525af180156104445761278b575b505f5b8381106125f857005b6126066107ef828685615021565b9060206001600160a01b03602481600554169460405195869384926302045be960e41b84521660048301525afa918215610444575f92612750575b5061264d818588615021565b35916001600160a01b0360085416906020604051809363095ea7b360e01b8252815f816126948a8860048401602090939291936001600160a01b0360408201951681520152565b03925af1918215610444576001600160a01b0392612734575b5016916001600160a01b036008541690833b1561044f576040517fb66503cf0000000000000000000000000000000000000000000000000000000081526001600160a01b039290921660048301526024820152915f908390604490829084905af191821561044457600192612724575b50016125ef565b5f61272e91614fff565b8661271d565b61274b9060203d8111611481576114738183614fff565b6126ad565b9091506020813d8211612783575b8161276b60209383614fff565b8101031261044f5761277c906151c2565b9086612641565b3d915061275e565b5f61279591614fff565b846125ec565b90506020813d6020116127c5575b816127b660209383614fff565b8101031261044f5751866125a1565b3d91506127a9565b6127e59060203d602011611481576114738183614fff565b612568565b90506020813d602011612816575b8161280560209383614fff565b8101031261044f575161255761252b565b3d91506127f8565b612837915060203d6020116124a7576124998183614fff565b876124fe565b3461044f575f36600319011261044f5760206001600160a01b0360025416604051908152f35b3461044f57602036600319011261044f5761287c615409565b6001600160a01b0360085416803b1561044f575f80916024604051809481937f32fef3cf00000000000000000000000000000000000000000000000000000000835260043560048401525af180156104445761043857005b3461044f575f36600319011261044f5760206040517fb3072e349cf62590698516830b9ea81d68c974027ccbf3c77e3d2a88743208e58152f35b3461044f575f36600319011261044f57612926615409565b61292e615409565b6001600160a01b0360085416604051631e49236560e21b8152602081600481855afa8015610444576001600160a01b03915f9161302e575b501690604051635c975abb60e01b8152602081600481855afa908115610444575f9161300f575b5015612fd5575b505f60206001600160a01b036006541660046040518094819363541b13ef60e11b83525af1801561044457612fa6575b506001600160a01b0360055416604051631ed2419560e01b8152602081600481855afa908115610444575f91612f74575b5060405192633251b17360e21b84525f84600481865afa938415610444575f94612f34575b5060405192630880b70160e01b8452826004850152602084602481845afa938415610444575f94612eff575b509260206024946040519586809263a5a645c160e01b82528760048301525afa938415610444575f94612ecb575b5084515f199490808611612ec3575b505f5b858110612a8f57005b6001600160a01b03600554166001600160a01b03612aad838a615394565b5116604051906348e321c760e11b82526004820152602081602481855afa80156104445787915f91612e8f575b5014612e86576040516370a0823160e01b8152816004820152602081602481895afa908115610444575f91612e55575b506001600160a01b03612b1d848b615394565b51166040519063036b50d960e11b82526004820152602081602481865afa80156104445788915f91612e13575b5060405163346c440f60e01b81526001600160a01b039091166004820152602481019190915260208180604481015b0381865afa8015610444575f90612de0575b612b969150866153a8565b670de0b6b3a7640000810290808204670de0b6b3a7640000149015171561221d57849080612dc65750505f915b818311612d81575b5050506001600160a01b03600554166001600160a01b03612bec838a615394565b511660405190631703e5f960e01b82526004820152602081602481855afa908115610444575f91612d63575b5015612cef57506001600160a01b03600554166001600160a01b03612c3d838a615394565b5116813b1561044f575f9160248392604051948593849263992a793360e01b845260048401525af1801561044457612cdf575b506001600160a01b0360055416906001600160a01b03612c90828a615394565b5116823b1561044f575f92602484926040519586938492639f06247b60e01b845260048401525af191821561044457600192612ccf575b505b01612a86565b5f612cd991614fff565b88612cc7565b5f612ce991614fff565b87612c70565b906001600160a01b03612d02828a615394565b511691803b1561044f57604051635824780d60e01b81526001600160a01b03939093166004840152602483018790525f908390604490829084905af191821561044457600192612d53575b50612cc9565b5f612d5d91614fff565b88612d4d565b612d7b915060203d8111611481576114738183614fff565b89612c18565b61219f602092612d90946153d9565b03815f895af1801561044457612da8575b8080612bcb565b612dbf9060203d8111611481576114738183614fff565b5087612da1565b670de0b6b3a764000091612dd9916153bb565b0491612bc3565b506020813d8211612e0b575b81612df960209383614fff565b8101031261044f57612b969051612b8b565b3d9150612dec565b9150506020813d8211612e4d575b81612e2e60209383614fff565b8101031261044f57602088612e45612b79936151c2565b915091612b4a565b3d9150612e21565b90506020813d8211612e7e575b81612e6f60209383614fff565b8101031261044f575189612b0a565b3d9150612e62565b50600190612cc9565b9150506020813d8211612ebb575b81612eaa60209383614fff565b8101031261044f578690518a612ada565b3d9150612e9d565b945086612a83565b9093506020813d602011612ef7575b81612ee760209383614fff565b8101031261044f57519285612a74565b3d9150612eda565b93506020843d602011612f2c575b81612f1a60209383614fff565b8101031261044f579251926020612a46565b3d9150612f0d565b9093503d805f833e612f468183614fff565b810160208282031261044f57815167ffffffffffffffff811161044f57612f6d92016151d6565b9284612a1a565b90506020813d602011612f9e575b81612f8f60209383614fff565b8101031261044f5751836129f5565b3d9150612f82565b6020813d602011612fcd575b81612fbf60209383614fff565b8101031261044f57516129c4565b3d9150612fb2565b803b1561044f575f8091600460405180948193638456cb5960e01b83525af180156104445715612994575f61300991614fff565b81612994565b613028915060203d602011611481576114738183614fff565b8361298d565b613047915060203d6020116124a7576124998183614fff565b83612966565b3461044f57602036600319011261044f57613066614e87565b61306e615409565b6001600160a01b036009541690813b1561044f576001600160a01b0360245f928360405195869485937f29605e770000000000000000000000000000000000000000000000000000000085521660048401525af180156104445761043857005b3461044f576130dc36614ec9565b6130e4615409565b808303610997575f5b8381106130f657005b6001600160a01b0360055416906131116107ef828789615021565b6001600160a01b03604051916302045be960e41b8352166004820152602081602481865afa908115610444575f91613251575b506001600160a01b03604051917ff55858b0000000000000000000000000000000000000000000000000000000008352166004820152602081602481865afa908115610444575f91613218575b506131a06107ef838688615021565b833b1561044f576040517f234823d70000000000000000000000000000000000000000000000000000000081526001600160a01b03928316600482015291166024820152915f908390604490829084905af191821561044457600192613208575b50016130ed565b5f61321291614fff565b86613201565b90506020813d8211613249575b8161323260209383614fff565b8101031261044f57613243906151c2565b87613191565b3d9150613225565b90506020813d8211613282575b8161326b60209383614fff565b8101031261044f5761327c906151c2565b87613144565b3d915061325e565b3461044f57602036600319011261044f576132a3615409565b6001600160a01b03600b5416803b1561044f575f80916024604051809481937f69fe0e2d00000000000000000000000000000000000000000000000000000000835260043560048401525af180156104445761043857005b3461044f57602036600319011261044f57613314614e87565b61331c615409565b6001600160a01b036008541690813b1561044f576001600160a01b0360245f928360405195869485937f6379808f0000000000000000000000000000000000000000000000000000000085521660048401525af180156104445761043857005b3461044f575f36600319011261044f5760206001600160a01b0360015416604051908152f35b3461044f57602036600319011261044f576133bb615409565b6001600160a01b03600b5416803b1561044f575f80916024604051809481937fcd962a0600000000000000000000000000000000000000000000000000000000835260043560048401525af180156104445761043857005b3461044f57602036600319011261044f5761342c614e87565b613434615409565b6001600160a01b03600d541690813b1561044f576001600160a01b0360245f92836040519586948593630787a21360e51b85521660048401525af180156104445761043857005b3461044f57602036600319011261044f57613494614ff0565b61349c615409565b156134f1576001600160a01b0360085416803b1561044f575f80916004604051809481937f3f4ba83a0000000000000000000000000000000000000000000000000000000083525af180156104445761043857005b6001600160a01b0360085416803b1561044f575f8091600460405180948193638456cb5960e01b83525af180156104445761043857005b3461044f5761353636614ec9565b61353e615478565b808303610997575f5b83811061355057005b6001600160a01b03600a54169061356b6107ef828789615021565b613576828587615021565b3560ff8116810361044f57833b1561044f57604051633b39a71f60e11b81526001600160a01b0392909216600483015260ff166024820152915f908390604490829084905af1918215610444576001926135d2575b5001613547565b5f6135dc91614fff565b866135cb565b3461044f57602036600319011261044f57613609336001600160a01b035f5416331461523b565b6001600160a01b03600e5416803b1561044f575f80916024604051809481937ff8f1c1ea00000000000000000000000000000000000000000000000000000000835260043560048401525af180156104445761043857005b3461044f57602036600319011261044f5761367a614e87565b613682615409565b6001600160a01b036005541690813b1561044f576001600160a01b0360245f928360405195869485937fc42cf5350000000000000000000000000000000000000000000000000000000085521660048401525af180156104445761043857005b3461044f575f36600319011261044f5760206001600160a01b0360055416604051908152f35b3461044f5761371636614ec9565b61371e615478565b808303610997575f5b83811061373057005b6001600160a01b03600b54169061374b6107ef828789615021565b613756828587615021565b35833b1561044f576040517f407c301e0000000000000000000000000000000000000000000000000000000081526001600160a01b039290921660048301526024820152915f908390604490829084905af1918215610444576001926137be575b5001613727565b5f6137c891614fff565b866137b7565b3461044f575f36600319011261044f5760206001600160a01b0360085416604051908152f35b3461044f576101e036600319011261044f577ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005460ff8160401c16159067ffffffffffffffff811680159081613df0575b6001149081613de6575b159081613ddd575b50613db5578160017fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000008316177ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0055613d60575b506001600160a01b036138bb61516a565b166001600160a01b03195f5416175f556001600160a01b036138db615180565b166001600160a01b031960015416176001556001600160a01b036138fd615045565b166001600160a01b031960055416176005556001600160a01b0361391f61505b565b166001600160a01b031960065416176006556001600160a01b03613941615071565b166001600160a01b031960075416176007556001600160a01b03613963615087565b166001600160a01b031960085416176008556001600160a01b0361398561509d565b166001600160a01b031960095416176009556001600160a01b036139a76150b3565b166001600160a01b0319600a541617600a556001600160a01b036139c96150c9565b166001600160a01b0319600b541617600b556001600160a01b036139eb6150e0565b166001600160a01b0319600c541617600c556001600160a01b03613a0d6150f7565b166001600160a01b0319600d541617600d556001600160a01b03613a2f61510e565b166001600160a01b0319600e541617600e556001600160a01b03613a51615125565b166001600160a01b031960025416176002556001600160a01b03613a7361513c565b166001600160a01b031960035416176003556001600160a01b03613a95615153565b166001600160a01b03196004541617600455613aaf615180565b613ab8816155f1565b613cdf575b50613ac6615180565b613acf816156c2565b613c5e575b50613add615180565b613ae68161578e565b613bfd575b50613af461516a565b613afd8161578e565b613b9c575b50613b0957005b7fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054167ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00557fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602060405160018152a1005b5f80527fc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e82371705932000602052613bf6906001600160a01b03167f615f0f9e84155bea8cc509fe18befeb1baf65611e38a6ba60964480fb29dfd446159dd565b5081613b02565b5f80527fc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e82371705932000602052613c57906001600160a01b03167f615f0f9e84155bea8cc509fe18befeb1baf65611e38a6ba60964480fb29dfd446159dd565b5081613aeb565b7fb3072e349cf62590698516830b9ea81d68c974027ccbf3c77e3d2a88743208e55f527fc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e82371705932000602052613cd8906001600160a01b03167f568bf0ecd8b65132af5e1d2c8b382a2e7790e9402475a0f5f035ae6ee744a97b6159dd565b5081613ad4565b7f0cee480c05aeabaa18fb824cd297ccabddb1b1a9a83b28d3f07e85c0cd25c4595f527fc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e82371705932000602052613d59906001600160a01b03167f804fa6144f67033cfe22eb2979e6ed2f1b6bf3f1941d7f1fa12d43ba65e665046159dd565b5081613abd565b7fffffffffffffffffffffffffffffffffffffffffffffff0000000000000000001668010000000000000001177ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0055816138aa565b7ff92ee8a9000000000000000000000000000000000000000000000000000000005f5260045ffd5b90501583613857565b303b15915061384f565b839150613845565b3461044f575f36600319011261044f5760206001600160a01b03600b5416604051908152f35b3461044f57602036600319011261044f57613e37614e87565b613e4d336001600160a01b035f5416331461523b565b6001600160a01b03600a541690813b1561044f576001600160a01b0360245f928360405195869485937fa42dce800000000000000000000000000000000000000000000000000000000085521660048401525af180156104445761043857005b3461044f57602036600319011261044f57613ec6615409565b6001600160a01b0360065416803b1561044f575f80916024604051809481937fd47ffef100000000000000000000000000000000000000000000000000000000835260043560048401525af180156104445761043857005b3461044f57602036600319011261044f57613f37614e87565b5f546001600160a01b0380821692613f513385331461523b565b16809214613f68576001600160a01b031916175f55005b7fcb105135000000000000000000000000000000000000000000000000000000005f5260045ffd5b3461044f57604036600319011261044f57613fa9614e9d565b336001600160a01b03821603613fc5576104429060043561559e565b7f6697b232000000000000000000000000000000000000000000000000000000005f5260045ffd5b3461044f57606036600319011261044f57614006614e87565b61400e614e9d565b906044358060020b810361044f57614024615409565b6001600160a01b0360055416803b1561044f576040517fe48bcc7d0000000000000000000000000000000000000000000000000000000081526001600160a01b03938416600482015293909216602484015260020b60448301525f90829081838160648101610428565b3461044f57604036600319011261044f576104426004356140ad614e9d565b906140e66106cd825f527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602052600160405f20015490565b615547565b3461044f57602036600319011261044f57614112336001600160a01b035f5416331461523b565b6001600160a01b03600e5416803b1561044f575f80916024604051809481937fd8e2d8f300000000000000000000000000000000000000000000000000000000835260043560048401525af180156104445761043857005b3461044f57602036600319011261044f57614183615409565b6001600160a01b03600d5416803b1561044f575f80916024604051809481937fd8e0d20c00000000000000000000000000000000000000000000000000000000835260043560048401525af180156104445761043857005b3461044f57602036600319011261044f5760206142256004355f527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602052600160405f20015490565b604051908152f35b3461044f57604036600319011261044f57614246614e87565b60243590811515820361044f5761425b615409565b6001600160a01b03600b541691823b1561044f576040517fe0bd111d0000000000000000000000000000000000000000000000000000000081526001600160a01b03909216600483015215156024820152905f90829081838160448101610428565b3461044f575f806142cd36614f8c565b92916142e8949194336001600160a01b03845416331461523b565b60405184868237828186810182815203925af13d1561438f573d67ffffffffffffffff811161437b5760405190614329601f8201601f191660200183614fff565b81525f60203d92013e5b1561433a57005b6143776040519283927f4715803300000000000000000000000000000000000000000000000000000000845260206004850152602484019161533d565b0390fd5b634e487b7160e01b5f52604160045260245ffd5b614333565b3461044f576101e036600319011261044f576143bc336001600160a01b035f5416331461523b565b6001600160a01b036143cc615045565b166001600160a01b031960055416176005556001600160a01b036143ee61505b565b166001600160a01b031960065416176006556001600160a01b03614410615071565b166001600160a01b031960075416176007556001600160a01b03614432615087565b166001600160a01b031960085416176008556001600160a01b0361445461509d565b166001600160a01b031960095416176009556001600160a01b036144766150b3565b166001600160a01b0319600a541617600a556001600160a01b036144986150c9565b166001600160a01b0319600b541617600b556001600160a01b036144ba6150e0565b166001600160a01b0319600c541617600c556001600160a01b036144dc6150f7565b166001600160a01b0319600d541617600d556001600160a01b036144fe61510e565b166001600160a01b0319600e541617600e556001600160a01b03614520615125565b166001600160a01b031960025416176002556001600160a01b0361454261513c565b166001600160a01b031960035416176003556001600160a01b03614564615153565b166001600160a01b031960045416176004555f80f35b3461044f57602036600319011261044f57614593614e87565b61459b615409565b6001600160a01b036007541690813b1561044f576001600160a01b0360245f928360405195869485937f2aeb8f220000000000000000000000000000000000000000000000000000000085521660048401525af180156104445761043857005b3461044f575f36600319011261044f5760206001600160a01b0360035416604051908152f35b3461044f57604036600319011261044f5761463a614e87565b614642615409565b6001600160a01b0360055416803b1561044f57604051635824780d60e01b81526001600160a01b03831660048201526024803590820152905f90829081838160448101610428565b3461044f5761469836614f1b565b9190936146a6959395615478565b8181148061481d575b15610997575f5b8181106146bf57005b6146cd610837828689615021565b1561477b576001600160a01b03600a5416906146ed6107ef828589615021565b916147016146fc83878c615021565b61532d565b92813b1561044f5760446001600160a01b03915f809462ffffff60405198899687957fba364c3d0000000000000000000000000000000000000000000000000000000087521660048601521660248401525af19182156104445760019261476b575b505b016146b6565b5f61477591614fff565b88614763565b6001600160a01b03600b5416906147966107ef828589615021565b916147a56146fc83878c615021565b92813b1561044f5760446001600160a01b03915f809462ffffff60405198899687957fa93a897d0000000000000000000000000000000000000000000000000000000087521660048601521660248401525af19182156104445760019261480d575b50614765565b5f61481791614fff565b88614807565b508282146146af565b3461044f5761483436614ec9565b929161483e615409565b838103610997576001600160a01b036008541690813b1561044f575f8094610428604051978896879586947f353140d0000000000000000000000000000000000000000000000000000000008652600486016152c5565b3461044f576101a036600319011261044f576148af614e87565b6148b7614e9d565b6148bf614eb3565b916064356001600160a01b03811680910361044f576084356001600160a01b03811680910361044f5760a4356001600160a01b03811680910361044f5760c4356001600160a01b03811680910361044f5760e4356001600160a01b03811680910361044f57610104356001600160a01b03811680910361044f5761012435916001600160a01b03831680930361044f5761014435936001600160a01b03851680950361044f5761016435956001600160a01b03871680970361044f5761018435976001600160a01b03891680990361044f576149a7336001600160a01b035f5416331461523b565b6001600160a01b0360055416998a3b1561044f576040519d8e809e819e7f2fdd983d0000000000000000000000000000000000000000000000000000000083526001600160a01b031660048301526001600160a01b031690602401526001600160a01b031660448d015260648c015260848b015260a48a015260c489015260e48801526101048701526101248601526101448501526101648401526101848301525a925f6101a4928195f180156104445761043857005b3461044f575f36600319011261044f5760206001600160a01b0360065416604051908152f35b3461044f57602036600319011261044f57614a9d614e87565b614ab3336001600160a01b035f5416331461523b565b6001600160a01b03600a541690813b1561044f576001600160a01b0360245f928360405195869485937f4bc2a6570000000000000000000000000000000000000000000000000000000085521660048401525af180156104445761043857005b3461044f57602036600319011261044f576004357fffffffff00000000000000000000000000000000000000000000000000000000811680910361044f57807f5a05180f0000000000000000000000000000000000000000000000000000000060209214908115614b8a575b506040519015158152f35b7f7965db0b00000000000000000000000000000000000000000000000000000000811491508115614bbd575b5082614b7f565b7f01ffc9a70000000000000000000000000000000000000000000000000000000091501482614bb6565b3461044f57602036600319011261044f5760043567ffffffffffffffff811161044f57614c18903690600401614e56565b614c20615409565b6001600160a01b03600554169160405190631ed2419560e01b8252602082600481875afa918215610444575f92614e22575b506001820180921161221d575f5b838110614c6957005b614c776107ef828685615021565b6040517feb9019d40000000000000000000000000000000000000000000000000000000081526001600160a01b0382166004820152602481018590529091905f816044818a5afa908115610444575f905f92614d6f575b5051159081614d65575b5015614d3057853b1561044f576001600160a01b0360405192636b8ab97d60e01b84521660048301525f82602481838a5af191821561044457600192614d20575b5001614c60565b5f614d2a91614fff565b86614d19565b6001600160a01b03827f8b033e4f000000000000000000000000000000000000000000000000000000005f521660045260245ffd5b9050511587614cd8565b9150503d805f833e614d818183614fff565b81019060408183031261044f57805167ffffffffffffffff811161044f5782614dab9183016151d6565b9060208101519067ffffffffffffffff821161044f57019180601f8401121561044f578251614dd9816151aa565b93614de76040519586614fff565b81855260208086019260051b82010192831161044f57602001905b828210614e125750505088614cce565b8151815260209182019101614e02565b9091506020813d602011614e4e575b81614e3e60209383614fff565b8101031261044f57519084614c52565b3d9150614e31565b9181601f8401121561044f5782359167ffffffffffffffff831161044f576020808501948460051b01011161044f57565b600435906001600160a01b038216820361044f57565b602435906001600160a01b038216820361044f57565b604435906001600160a01b038216820361044f57565b604060031982011261044f5760043567ffffffffffffffff811161044f5781614ef491600401614e56565b929092916024359067ffffffffffffffff821161044f57614f1791600401614e56565b9091565b606060031982011261044f5760043567ffffffffffffffff811161044f5781614f4691600401614e56565b9290929160243567ffffffffffffffff811161044f5781614f6991600401614e56565b929092916044359067ffffffffffffffff821161044f57614f1791600401614e56565b604060031982011261044f576004356001600160a01b038116810361044f579160243567ffffffffffffffff811161044f5760040182601f8201121561044f5780359267ffffffffffffffff841161044f576020848184019301011161044f579190565b60043590811515820361044f57565b90601f8019910116810190811067ffffffffffffffff82111761437b57604052565b91908110156150315760051b0190565b634e487b7160e01b5f52603260045260245ffd5b6044356001600160a01b038116810361044f5790565b6064356001600160a01b038116810361044f5790565b6084356001600160a01b038116810361044f5790565b60a4356001600160a01b038116810361044f5790565b60c4356001600160a01b038116810361044f5790565b60e4356001600160a01b038116810361044f5790565b610104356001600160a01b038116810361044f5790565b610164356001600160a01b038116810361044f5790565b6101a4356001600160a01b038116810361044f5790565b6101c4356001600160a01b038116810361044f5790565b610124356001600160a01b038116810361044f5790565b610144356001600160a01b038116810361044f5790565b610184356001600160a01b038116810361044f5790565b6004356001600160a01b038116810361044f5790565b6024356001600160a01b038116810361044f5790565b356001600160a01b038116810361044f5790565b67ffffffffffffffff811161437b5760051b60200190565b51906001600160a01b038216820361044f57565b9080601f8301121561044f5781516151ed816151aa565b926151fb6040519485614fff565b81845260208085019260051b82010192831161044f57602001905b8282106152235750505090565b60208091615230846151c2565b815201910190615216565b156152435750565b6001600160a01b03907fc483b14a000000000000000000000000000000000000000000000000000000005f521660045260245ffd5b916020908281520191905f905b8082106152925750505090565b9091928335906001600160a01b038216820361044f57602080916001600160a01b03600194168152019401920190615285565b906152de90602093959495604084526040840191615278565b90828183039101528281520191905f905b8082106152fc5750505090565b90919283359081151580920361044f576020816001938293520194019201906152ef565b35801515810361044f5790565b3562ffffff8116810361044f5790565b908060209392818452848401375f828201840152601f01601f1916010190565b9081602091031261044f57516001600160a01b038116810361044f5790565b9081602091031261044f5751801515810361044f5790565b80518210156150315760209160051b010190565b8181029291811591840414171561221d57565b81156153c5570490565b634e487b7160e01b5f52601260045260245ffd5b9190820391821161221d57565b6040906001600160a01b036154069593168152816020820152019161533d565b90565b335f9081527f3b05fb06f7501e09d6a8a50c59dac59cd7c8dab47e848ae345bfca5e4d5d9e3c602052604090205460ff161561544157565b63e2517d3f60e01b5f52336004527fb3072e349cf62590698516830b9ea81d68c974027ccbf3c77e3d2a88743208e560245260445ffd5b335f9081527f9eacbbea19e14d84ae6fc89bafe3fe4134e0cfcdae6894d6d7239131d0cd8325602052604090205460ff16156154b057565b63e2517d3f60e01b5f52336004527f0cee480c05aeabaa18fb824cd297ccabddb1b1a9a83b28d3f07e85c0cd25c45960245260445ffd5b805f527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b62680060205260405f206001600160a01b0333165f5260205260ff60405f205416156155315750565b63e2517d3f60e01b5f523360045260245260445ffd5b6155518282615838565b918261555c57505090565b61559a915f527fc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e823717059320006020526001600160a01b0360405f209116906159dd565b5090565b6155a88282615905565b91826155b357505090565b61559a915f527fc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e823717059320006020526001600160a01b0360405f20911690615a4c565b6001600160a01b0381165f9081527f9eacbbea19e14d84ae6fc89bafe3fe4134e0cfcdae6894d6d7239131d0cd8325602052604090205460ff166156bd576001600160a01b03165f8181527f9eacbbea19e14d84ae6fc89bafe3fe4134e0cfcdae6894d6d7239131d0cd832560205260408120805460ff191660011790553391907f0cee480c05aeabaa18fb824cd297ccabddb1b1a9a83b28d3f07e85c0cd25c459907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9080a4600190565b505f90565b6001600160a01b0381165f9081527f3b05fb06f7501e09d6a8a50c59dac59cd7c8dab47e848ae345bfca5e4d5d9e3c602052604090205460ff166156bd576001600160a01b03165f8181527f3b05fb06f7501e09d6a8a50c59dac59cd7c8dab47e848ae345bfca5e4d5d9e3c60205260408120805460ff191660011790553391907fb3072e349cf62590698516830b9ea81d68c974027ccbf3c77e3d2a88743208e5907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9080a4600190565b6001600160a01b0381165f9081527fb7db2dd08fcb62d0c9e08c51941cae53c267786a0b75803fb7960902fc8ef97d602052604090205460ff166156bd576001600160a01b03165f8181527fb7db2dd08fcb62d0c9e08c51941cae53c267786a0b75803fb7960902fc8ef97d60205260408120805460ff191660011790553391907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8180a4600190565b805f527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b62680060205260405f206001600160a01b0383165f5260205260ff60405f205416155f146158ff57805f527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b62680060205260405f206001600160a01b0383165f5260205260405f20600160ff198254161790556001600160a01b03339216907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d5f80a4600190565b50505f90565b805f527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b62680060205260405f206001600160a01b0383165f5260205260ff60405f2054165f146158ff57805f527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b62680060205260405f206001600160a01b0383165f5260205260405f2060ff1981541690556001600160a01b03339216907ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b5f80a4600190565b8054821015615031575f5260205f2001905f90565b6001810190825f528160205260405f2054155f14615a455780546801000000000000000081101561437b57615a32615a1c8260018794018555846159c8565b819391549060031b91821b915f19901b19161790565b905554915f5260205260405f2055600190565b5050505f90565b906001820191815f528260205260405f20548015155f14615b09575f19810181811161221d5782545f1981019190821161221d57818103615ad4575b50505080548015615ac0575f190190615aa182826159c8565b8154905f199060031b1b19169055555f526020525f6040812055600190565b634e487b7160e01b5f52603160045260245ffd5b615af4615ae4615a1c93866159c8565b90549060031b1c928392866159c8565b90555f528360205260405f20555f8080615a88565b505050505f9056fea26469706673582212203e8ca5dac91c130d37235afa75377bfe1084fea2579d0a5b385d9ede7a08567564736f6c634300081c0033f0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00

Deployed Bytecode

0x60806040526004361015610011575f80fd5b5f3560e01c80620c07c714614be757806301ffc9a714614b1357806302be9a9014614a845780630754617214614a5e57806307a8d4ef14614895578063083eebfc1461482657806309651f7d1461468a5780630c2e061f146146215780630d52333c146145fb578063163588061461457a5780631869c94a146143945780631cff79cd146142bd5780631eadbd8b1461422d578063248a9ca3146141db5780632a59c8061461416a5780632eb64795146140eb5780632f2ff15d1461408e578063360e16de14613fed57806336568abe14613f905780633abdbf2a14613f1e5780633eadd56e14613ead5780634135afbe14613e1e5780634219dc4014613df8578063421f2aae146137f45780634256f5e7146137ce5780634345f59a1461370857806346c96aac146136e257806349fe8228146136615780634b9880c1146135e25780634cb4d827146135285780634d4ce1c11461347b57806352e0970f146134135780635cb62a08146133a257806361d027b31461337c5780636379808f146132fb578063687b01351461328a57806369e0bc05146130ce5780636e57f00e1461304d578063750520781461290e57806378b1a8c7146128d45780637a707730146128635780637bebe3811461283d5780637c972e2e146124ae5780638019b6b714611d1757806380a1ebbb14611c4557806382169aec14611af8578063839006f214611a0557806385caf28b146119df5780638cb422f0146119a55780639010d07c1461194257806390291058146118c757806390bcc5a21461167957806391742be01461160a57806391d14854146115a157806393208a2b1461157b5780639647d1411461155557806398bbc3c71461152f5780639987e757146114ae5780639a17759b146114885780639e3dc42d14611176578063a217fddf1461115c578063a3246ad31461108e578063a56bcb4c1461100c578063a71504ad14610f9b578063ab0e019214610f33578063b7923cd014610eca578063ba01351014610e59578063bb511b5e14610de3578063be02ec3814610c24578063beb7dc3414610b5f578063c1463c1514610ac5578063c415b95c14610a9f578063c5f720e414610a79578063c9d068fd14610a11578063ca15c873146109c8578063ca1699e8146107a1578063ca62573a14610722578063d32af6c1146106fc578063d33219b4146106d7578063d547741f14610675578063dbb466df146105e9578063e6dca2b214610568578063e95245fd146104e7578063eee0fdb4146104535763f7553c52146103bf575f80fd5b3461044f576103cd36614f8c565b6103d8929192615409565b6001600160a01b0360075416803b1561044f57610428935f8094604051968795869485937f2cd21e00000000000000000000000000000000000000000000000000000000008552600485016153e6565b03925af180156104445761043857005b5f61044291614fff565b005b6040513d5f823e3d90fd5b5f80fd5b3461044f57604036600319011261044f576004358060020b80910361044f576024359062ffffff821680920361044f5761048b615409565b6001600160a01b03600a541691823b1561044f5760445f928360405195869485937feee0fdb4000000000000000000000000000000000000000000000000000000008552600485015260248401525af180156104445761043857005b3461044f57602036600319011261044f57610500614e87565b610508615409565b6001600160a01b036007541690813b1561044f576001600160a01b0360245f928360405195869485937fb3ab15fb0000000000000000000000000000000000000000000000000000000085521660048401525af180156104445761043857005b3461044f57602036600319011261044f57610581614e87565b610589615409565b6001600160a01b036007541690813b1561044f576001600160a01b0360245f928360405195869485937fdcaaa61b0000000000000000000000000000000000000000000000000000000085521660048401525af180156104445761043857005b3461044f57604036600319011261044f57610602614e87565b61060a614e9d565b90610613615409565b6001600160a01b036007541691823b1561044f576040517f772b7e970000000000000000000000000000000000000000000000000000000081526001600160a01b03928316600482015291166024820152905f90829081838160448101610428565b3461044f57604036600319011261044f57610442600435610694614e9d565b906106d26106cd825f527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602052600160405f20015490565b6154e7565b61559e565b3461044f575f36600319011261044f5760206001600160a01b035f5416604051908152f35b3461044f575f36600319011261044f5760206001600160a01b03600c5416604051908152f35b3461044f57602036600319011261044f5760043560ff811680910361044f57610749615409565b6001600160a01b03600a541690813b1561044f575f916024839260405194859384927fb613a14100000000000000000000000000000000000000000000000000000000845260048401525af180156104445761043857005b3461044f576107af36614f1b565b6107bb95919395615409565b828514806109bf575b15610997575f5b8581106107d457005b6001600160a01b0360055416906107f46107ef828987615021565b615196565b916001600160a01b03604051936302045be960e41b8552166004840152602083602481845afa928315610444575f9361095c575b5061083c61083783868a615021565b615320565b156108d657506001600160a01b03600554169161085d6107ef83888c615021565b833b1561044f576040517fd36f07280000000000000000000000000000000000000000000000000000000081526001600160a01b03928316600482015291166024820152915f908390604490829084905af1918215610444576001926108c6575b505b016107cb565b5f6108d091614fff565b886108be565b916108e56107ef83888c615021565b833b1561044f576040517fffc0a01e0000000000000000000000000000000000000000000000000000000081526001600160a01b03928316600482015291166024820152915f908390604490829084905af19182156104445760019261094c575b506108c0565b5f61095691614fff565b88610946565b9092506020813d821161098f575b8161097760209383614fff565b8101031261044f57610988906151c2565b9189610828565b3d915061096a565b7f899ef10d000000000000000000000000000000000000000000000000000000005f5260045ffd5b508083146107c4565b3461044f57602036600319011261044f576004355f527fc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e82371705932000602052602060405f2054604051908152f35b3461044f57602036600319011261044f57610a2a614e87565b610a32615409565b6001600160a01b03600b541690813b1561044f576001600160a01b0360245f92836040519586948593630787a21360e51b85521660048401525af180156104445761043857005b3461044f575f36600319011261044f5760206001600160a01b0360095416604051908152f35b3461044f575f36600319011261044f5760206001600160a01b03600d5416604051908152f35b3461044f57606036600319011261044f57610ade614e87565b610ae6614eb3565b90610aef615409565b6001600160a01b036007541690813b1561044f5760646001600160a01b03915f80948460405197889687957fd309dbc600000000000000000000000000000000000000000000000000000000875216600486015260243560248601521660448401525af180156104445761043857005b3461044f57610b6d36614ec9565b909192610b78615409565b6001600160a01b036008541690813b1561044f57610bc890604051957fbeb7dc34000000000000000000000000000000000000000000000000000000008752604060048801526044870191615278565b848103600319016024860152828152917f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811161044f575f60208682968196829560051b809285830137010301925af180156104445761043857005b3461044f57602036600319011261044f5760043567ffffffffffffffff811161044f57610c55903690600401614e56565b90610c5e615409565b5f5b828110610c6957005b610c776107ef828585615021565b906001600160a01b0380600d5416921691803b1561044f575f8091602460405180948193632a54db0160e01b83528860048401525af1801561044457610dd3575b506001600160a01b03600554166040516302045be960e41b8152836004820152602081602481855afa908115610444575f91610d9a575b50813b1561044f576001600160a01b0360245f9283604051958694859363992a793360e01b85521660048401525af1801561044457610d8a575b506001600160a01b03600a541691823b1561044f575f92604484926040519586938492633b39a71f60e11b84526004840152600560248401525af191821561044457600192610d7a575b5001610c60565b5f610d8491614fff565b84610d73565b5f610d9491614fff565b84610d29565b90506020813d8211610dcb575b81610db460209383614fff565b8101031261044f57610dc5906151c2565b86610cef565b3d9150610da7565b5f610ddd91614fff565b84610cb8565b3461044f57602036600319011261044f57610dfc614e87565b610e12336001600160a01b035f5416331461523b565b6001600160a01b036005541690813b1561044f576001600160a01b0360245f92836040519586948593636b8ab97d60e01b85521660048401525af180156104445761043857005b3461044f57602036600319011261044f57610e72615409565b6001600160a01b0360055416803b1561044f575f80916024604051809481937f0f14763200000000000000000000000000000000000000000000000000000000835260043560048401525af180156104445761043857005b3461044f57610ed836614f8c565b610ee3929192615409565b6001600160a01b0360075416803b1561044f57610428935f8094604051968795869485937fc657c718000000000000000000000000000000000000000000000000000000008552600485016153e6565b3461044f57602036600319011261044f57610f4c614e87565b610f54615409565b6001600160a01b03600c541690813b1561044f576001600160a01b0360245f92836040519586948593630787a21360e51b85521660048401525af180156104445761043857005b3461044f57602036600319011261044f57610fb4615409565b6001600160a01b03600c5416803b1561044f575f80916024604051809481937f019494b300000000000000000000000000000000000000000000000000000000835260043560048401525af180156104445761043857005b3461044f57604036600319011261044f57611025614e87565b61102d615409565b6001600160a01b0360095416803b1561044f576040517f7a4e4ecf0000000000000000000000000000000000000000000000000000000081526001600160a01b03831660048201526024803590820152905f90829081838160448101610428565b3461044f57602036600319011261044f576004355f527fc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e8237170593200060205260405f20604051806020835491828152019081935f5260205f20905f5b81811061114657505050816110fb910382614fff565b604051918291602083019060208452518091526040830191905f5b818110611124575050500390f35b82516001600160a01b0316845285945060209384019390920191600101611116565b82548452602090930192600192830192016110e5565b3461044f575f36600319011261044f5760206040515f8152f35b3461044f57602036600319011261044f5761118f614e87565b611197615409565b6001600160a01b03602081600a5416926024604051809481937f42378e9500000000000000000000000000000000000000000000000000000000835216958660048301525afa908115610444575f91611459575b501561140857604051907f0dfe1681000000000000000000000000000000000000000000000000000000008252602082600481845afa918215610444575f926113cc575b50604051907fd21220a7000000000000000000000000000000000000000000000000000000008252602082600481845afa918215610444575f9261138d575b50906020600492604051938480927fd0c93a7c0000000000000000000000000000000000000000000000000000000082525afa918215610444575f9261134d575b506005546040517fd1cf58f20000000000000000000000000000000000000000000000000000000081526001600160a01b039485166004820152918416602483015260029290920b604482015291602091839116815f81606481015b03925af180156104445761131b57005b6020813d602011611345575b8161133460209383614fff565b8101031261044f57610442906151c2565b3d9150611327565b9091506020813d602011611385575b8161136960209383614fff565b8101031261044f5751908160020b820361044f5761130b6112af565b3d915061135c565b91506020823d6020116113c4575b816113a860209383614fff565b8101031261044f5760206113bd6004936151c2565b925061126e565b3d915061139b565b9091506020813d602011611400575b816113e860209383614fff565b8101031261044f576113f9906151c2565b908261122f565b3d91506113db565b60205f9160246001600160a01b03600554169160405194859384927fa5f4301e00000000000000000000000000000000000000000000000000000000845260048401525af180156104445761131b57005b61147b915060203d602011611481575b6114738183614fff565b81019061537c565b826111eb565b503d611469565b3461044f575f36600319011261044f5760206001600160a01b03600a5416604051908152f35b3461044f57602036600319011261044f576114c7614e87565b6114cf615409565b6001600160a01b036007541690813b1561044f576001600160a01b0360245f928360405195869485937f595aeb500000000000000000000000000000000000000000000000000000000085521660048401525af180156104445761043857005b3461044f575f36600319011261044f5760206001600160a01b03600f5416604051908152f35b3461044f575f36600319011261044f5760206001600160a01b0360045416604051908152f35b3461044f575f36600319011261044f5760206001600160a01b0360075416604051908152f35b3461044f57604036600319011261044f576115ba614e9d565b6004355f527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006020526001600160a01b0360405f2091165f52602052602060ff60405f2054166040519015158152f35b3461044f5761161836614ec9565b9291611622615409565b838103610997576001600160a01b036008541690813b1561044f575f8094610428604051978896879586947f94126bb1000000000000000000000000000000000000000000000000000000008652600486016152c5565b3461044f57602036600319011261044f5760043567ffffffffffffffff811161044f576116aa903690600401614e56565b906116b3615409565b5f5b8281106116be57005b6116cc6107ef828585615021565b906001600160a01b03600d54166001600160a01b03831690803b1561044f575f8091602460405180948193632a54db0160e01b83528760048401525af18015610444576118b7575b506001600160a01b036005541690604051906302045be960e41b82526004820152602081602481855afa908115610444575f9161187e575b50813b1561044f576001600160a01b0360245f92836040519586948593639f06247b60e01b85521660048401525af180156104445761186e575b506001600160a01b03600a5416916040517f527eb4bc000000000000000000000000000000000000000000000000000000008152602081600481875afa908115610444575f91611833575b50833b1561044f57604051633b39a71f60e11b81526001600160a01b0392909216600483015260ff166024820152915f908390604490829084905af191821561044457600192611823575b50016116b5565b5f61182d91614fff565b8461181c565b90506020813d8211611866575b8161184d60209383614fff565b8101031261044f575160ff8116810361044f57866117d1565b3d9150611840565b5f61187891614fff565b84611786565b90506020813d82116118af575b8161189860209383614fff565b8101031261044f576118a9906151c2565b8661174c565b3d915061188b565b5f6118c191614fff565b85611714565b3461044f57602036600319011261044f576118e0614ff0565b6118e8615409565b6001600160a01b03600b541690813b1561044f575f916024839260405194859384927f90291058000000000000000000000000000000000000000000000000000000008452151560048401525af180156104445761043857005b3461044f57604036600319011261044f576004355f527fc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e8237170593200060205260206001600160a01b0361199560243560405f206159c8565b90549060031b1c16604051908152f35b3461044f575f36600319011261044f5760206040517f0cee480c05aeabaa18fb824cd297ccabddb1b1a9a83b28d3f07e85c0cd25c4598152f35b3461044f575f36600319011261044f5760206001600160a01b03600e5416604051908152f35b3461044f57602036600319011261044f576001600160a01b03611a26614e87565b611a2e615409565b166001600160a01b0360015416604051906370a0823160e01b8252306004830152602082602481865afa918215610444575f92611ac2575b5060405163a9059cbb60e01b81526001600160a01b0390911660048201526024810191909152906020908290815f81604481015b03925af1801561044457611aaa57005b6104429060203d602011611481576114738183614fff565b91506020823d602011611af0575b81611add60209383614fff565b8101031261044f57905190611a9a611a66565b3d9150611ad0565b3461044f57611b0636614ec9565b9091611b10615409565b818103610997575f5b818110611b2257005b611b30610837828587615021565b15611bbe576001600160a01b036005541690611b506107ef828589615021565b823b1561044f576001600160a01b0360245f928360405196879485937f9b19251a0000000000000000000000000000000000000000000000000000000085521660048401525af191821561044457600192611bae575b505b01611b19565b5f611bb891614fff565b86611ba6565b6001600160a01b036005541690611bd96107ef828589615021565b823b1561044f576001600160a01b0360245f928360405196879485937f9c7f33150000000000000000000000000000000000000000000000000000000085521660048401525af191821561044457600192611c35575b50611ba8565b5f611c3f91614fff565b86611c2f565b3461044f57611c5336614ec9565b91611c6a336001600160a01b035f5416331461523b565b5f5b818110611c7557005b6001600160a01b03600e541690611c906107ef828589615021565b611c9e610837838888615021565b833b1561044f576040517fc717374a0000000000000000000000000000000000000000000000000000000081526001600160a01b0392909216600483015215156024820152915f908390604490829084905af191821561044457600192611d07575b5001611c6c565b5f611d1191614fff565b86611d00565b3461044f57604036600319011261044f57600435611d33615409565b6001600160a01b036008541690604051631e49236560e21b8152602081600481865afa8015610444576001600160a01b03915f9161247f575b501691604051635c975abb60e01b8152602081600481855afa908115610444575f91612460575b5015612426575b505f60206001600160a01b036006541660046040518094819363541b13ef60e11b83525af18015610444576123f7575b506001600160a01b03600554169160405190631ed2419560e01b8252602082600481875afa918215610444575f926123c3575b5060405193633251b17360e21b85525f85600481845afa948515610444575f95612383575b5060405190630880b70160e01b8252836004830152602082602481845afa918215610444575f9261234e575b5060206024916040519283809263a5a645c160e01b82528860048301525afa908115610444575f9161231c575b5060243585019485811161221d578651808711612314575b505b858110611e9e57005b6001600160a01b03600554166001600160a01b03611ebc838a615394565b5116604051906348e321c760e11b82526004820152602081602481855afa80156104445787915f916122e0575b50146122d7576040516370a0823160e01b8152816004820152602081602481895afa908115610444575f916122a6575b506001600160a01b03611f2c848b615394565b51166040519063036b50d960e11b82526004820152602081602481865afa80156104445788915f91612264575b5060405163346c440f60e01b81526001600160a01b039091166004820152602481019190915260208180604481015b0381865afa8015610444575f90612231575b611fa59150866153a8565b670de0b6b3a7640000810290808204670de0b6b3a7640000149015171561221d578490806122035750505f915b818311612190575b5050506001600160a01b03600554166001600160a01b03611ffb838a615394565b511660405190631703e5f960e01b82526004820152602081602481855afa908115610444575f91612172575b50156120fe57506001600160a01b03600554166001600160a01b0361204c838a615394565b5116813b1561044f575f9160248392604051948593849263992a793360e01b845260048401525af18015610444576120ee575b506001600160a01b0360055416906001600160a01b0361209f828a615394565b5116823b1561044f575f92602484926040519586938492639f06247b60e01b845260048401525af1918215610444576001926120de575b505b01611e95565b5f6120e891614fff565b886120d6565b5f6120f891614fff565b8761207f565b906001600160a01b03612111828a615394565b511691803b1561044f57604051635824780d60e01b81526001600160a01b03939093166004840152602483018790525f908390604490829084905af191821561044457600192612162575b506120d8565b5f61216c91614fff565b8861215c565b61218a915060203d8111611481576114738183614fff565b89612027565b61219f6020926121cd946153d9565b60405163a9059cbb60e01b81526001600160a01b039092166004830152602482015291829081906044820190565b03815f895af18015610444576121e5575b8080611fda565b6121fc9060203d8111611481576114738183614fff565b50876121de565b670de0b6b3a764000091612216916153bb565b0491611fd2565b634e487b7160e01b5f52601160045260245ffd5b506020813d821161225c575b8161224a60209383614fff565b8101031261044f57611fa59051611f9a565b3d915061223d565b9150506020813d821161229e575b8161227f60209383614fff565b8101031261044f57602088612296611f88936151c2565b915091611f59565b3d9150612272565b90506020813d82116122cf575b816122c060209383614fff565b8101031261044f575189611f19565b3d91506122b3565b506001906120d8565b9150506020813d821161230c575b816122fb60209383614fff565b8101031261044f578690518a611ee9565b3d91506122ee565b955087611e93565b90506020813d602011612346575b8161233760209383614fff565b8101031261044f575186611e7b565b3d915061232a565b9091506020813d60201161237b575b8161236a60209383614fff565b8101031261044f5751906020611e4e565b3d915061235d565b9094503d805f833e6123958183614fff565b810160208282031261044f57815167ffffffffffffffff811161044f576123bc92016151d6565b9385611e22565b9091506020813d6020116123ef575b816123df60209383614fff565b8101031261044f57519084611dfd565b3d91506123d2565b6020813d60201161241e575b8161241060209383614fff565b8101031261044f5751611dca565b3d9150612403565b803b1561044f575f8091600460405180948193638456cb5960e01b83525af180156104445715611d9a575f61245a91614fff565b82611d9a565b612479915060203d602011611481576114738183614fff565b84611d93565b6124a1915060203d6020116124a7575b6124998183614fff565b81019061535d565b84611d6c565b503d61248f565b3461044f576124bc36614ec9565b90926124c6615409565b6001600160a01b0360085416604051631e49236560e21b8152602081600481855afa8015610444576001600160a01b03915f9161281e575b5016906040516370a0823160e01b8152306004820152602081602481865afa908115610444575f916127ea575b5060405163095ea7b360e01b81526001600160a01b039092166004830152602482015260208180604481015b03815f865af18015610444576127cd575b50602460206001600160a01b036008541692604051928380926370a0823160e01b82523060048301525afa908115610444575f9161279b575b50813b1561044f575f916024839260405194859384927f12e8267400000000000000000000000000000000000000000000000000000000845260048401525af180156104445761278b575b505f5b8381106125f857005b6126066107ef828685615021565b9060206001600160a01b03602481600554169460405195869384926302045be960e41b84521660048301525afa918215610444575f92612750575b5061264d818588615021565b35916001600160a01b0360085416906020604051809363095ea7b360e01b8252815f816126948a8860048401602090939291936001600160a01b0360408201951681520152565b03925af1918215610444576001600160a01b0392612734575b5016916001600160a01b036008541690833b1561044f576040517fb66503cf0000000000000000000000000000000000000000000000000000000081526001600160a01b039290921660048301526024820152915f908390604490829084905af191821561044457600192612724575b50016125ef565b5f61272e91614fff565b8661271d565b61274b9060203d8111611481576114738183614fff565b6126ad565b9091506020813d8211612783575b8161276b60209383614fff565b8101031261044f5761277c906151c2565b9086612641565b3d915061275e565b5f61279591614fff565b846125ec565b90506020813d6020116127c5575b816127b660209383614fff565b8101031261044f5751866125a1565b3d91506127a9565b6127e59060203d602011611481576114738183614fff565b612568565b90506020813d602011612816575b8161280560209383614fff565b8101031261044f575161255761252b565b3d91506127f8565b612837915060203d6020116124a7576124998183614fff565b876124fe565b3461044f575f36600319011261044f5760206001600160a01b0360025416604051908152f35b3461044f57602036600319011261044f5761287c615409565b6001600160a01b0360085416803b1561044f575f80916024604051809481937f32fef3cf00000000000000000000000000000000000000000000000000000000835260043560048401525af180156104445761043857005b3461044f575f36600319011261044f5760206040517fb3072e349cf62590698516830b9ea81d68c974027ccbf3c77e3d2a88743208e58152f35b3461044f575f36600319011261044f57612926615409565b61292e615409565b6001600160a01b0360085416604051631e49236560e21b8152602081600481855afa8015610444576001600160a01b03915f9161302e575b501690604051635c975abb60e01b8152602081600481855afa908115610444575f9161300f575b5015612fd5575b505f60206001600160a01b036006541660046040518094819363541b13ef60e11b83525af1801561044457612fa6575b506001600160a01b0360055416604051631ed2419560e01b8152602081600481855afa908115610444575f91612f74575b5060405192633251b17360e21b84525f84600481865afa938415610444575f94612f34575b5060405192630880b70160e01b8452826004850152602084602481845afa938415610444575f94612eff575b509260206024946040519586809263a5a645c160e01b82528760048301525afa938415610444575f94612ecb575b5084515f199490808611612ec3575b505f5b858110612a8f57005b6001600160a01b03600554166001600160a01b03612aad838a615394565b5116604051906348e321c760e11b82526004820152602081602481855afa80156104445787915f91612e8f575b5014612e86576040516370a0823160e01b8152816004820152602081602481895afa908115610444575f91612e55575b506001600160a01b03612b1d848b615394565b51166040519063036b50d960e11b82526004820152602081602481865afa80156104445788915f91612e13575b5060405163346c440f60e01b81526001600160a01b039091166004820152602481019190915260208180604481015b0381865afa8015610444575f90612de0575b612b969150866153a8565b670de0b6b3a7640000810290808204670de0b6b3a7640000149015171561221d57849080612dc65750505f915b818311612d81575b5050506001600160a01b03600554166001600160a01b03612bec838a615394565b511660405190631703e5f960e01b82526004820152602081602481855afa908115610444575f91612d63575b5015612cef57506001600160a01b03600554166001600160a01b03612c3d838a615394565b5116813b1561044f575f9160248392604051948593849263992a793360e01b845260048401525af1801561044457612cdf575b506001600160a01b0360055416906001600160a01b03612c90828a615394565b5116823b1561044f575f92602484926040519586938492639f06247b60e01b845260048401525af191821561044457600192612ccf575b505b01612a86565b5f612cd991614fff565b88612cc7565b5f612ce991614fff565b87612c70565b906001600160a01b03612d02828a615394565b511691803b1561044f57604051635824780d60e01b81526001600160a01b03939093166004840152602483018790525f908390604490829084905af191821561044457600192612d53575b50612cc9565b5f612d5d91614fff565b88612d4d565b612d7b915060203d8111611481576114738183614fff565b89612c18565b61219f602092612d90946153d9565b03815f895af1801561044457612da8575b8080612bcb565b612dbf9060203d8111611481576114738183614fff565b5087612da1565b670de0b6b3a764000091612dd9916153bb565b0491612bc3565b506020813d8211612e0b575b81612df960209383614fff565b8101031261044f57612b969051612b8b565b3d9150612dec565b9150506020813d8211612e4d575b81612e2e60209383614fff565b8101031261044f57602088612e45612b79936151c2565b915091612b4a565b3d9150612e21565b90506020813d8211612e7e575b81612e6f60209383614fff565b8101031261044f575189612b0a565b3d9150612e62565b50600190612cc9565b9150506020813d8211612ebb575b81612eaa60209383614fff565b8101031261044f578690518a612ada565b3d9150612e9d565b945086612a83565b9093506020813d602011612ef7575b81612ee760209383614fff565b8101031261044f57519285612a74565b3d9150612eda565b93506020843d602011612f2c575b81612f1a60209383614fff565b8101031261044f579251926020612a46565b3d9150612f0d565b9093503d805f833e612f468183614fff565b810160208282031261044f57815167ffffffffffffffff811161044f57612f6d92016151d6565b9284612a1a565b90506020813d602011612f9e575b81612f8f60209383614fff565b8101031261044f5751836129f5565b3d9150612f82565b6020813d602011612fcd575b81612fbf60209383614fff565b8101031261044f57516129c4565b3d9150612fb2565b803b1561044f575f8091600460405180948193638456cb5960e01b83525af180156104445715612994575f61300991614fff565b81612994565b613028915060203d602011611481576114738183614fff565b8361298d565b613047915060203d6020116124a7576124998183614fff565b83612966565b3461044f57602036600319011261044f57613066614e87565b61306e615409565b6001600160a01b036009541690813b1561044f576001600160a01b0360245f928360405195869485937f29605e770000000000000000000000000000000000000000000000000000000085521660048401525af180156104445761043857005b3461044f576130dc36614ec9565b6130e4615409565b808303610997575f5b8381106130f657005b6001600160a01b0360055416906131116107ef828789615021565b6001600160a01b03604051916302045be960e41b8352166004820152602081602481865afa908115610444575f91613251575b506001600160a01b03604051917ff55858b0000000000000000000000000000000000000000000000000000000008352166004820152602081602481865afa908115610444575f91613218575b506131a06107ef838688615021565b833b1561044f576040517f234823d70000000000000000000000000000000000000000000000000000000081526001600160a01b03928316600482015291166024820152915f908390604490829084905af191821561044457600192613208575b50016130ed565b5f61321291614fff565b86613201565b90506020813d8211613249575b8161323260209383614fff565b8101031261044f57613243906151c2565b87613191565b3d9150613225565b90506020813d8211613282575b8161326b60209383614fff565b8101031261044f5761327c906151c2565b87613144565b3d915061325e565b3461044f57602036600319011261044f576132a3615409565b6001600160a01b03600b5416803b1561044f575f80916024604051809481937f69fe0e2d00000000000000000000000000000000000000000000000000000000835260043560048401525af180156104445761043857005b3461044f57602036600319011261044f57613314614e87565b61331c615409565b6001600160a01b036008541690813b1561044f576001600160a01b0360245f928360405195869485937f6379808f0000000000000000000000000000000000000000000000000000000085521660048401525af180156104445761043857005b3461044f575f36600319011261044f5760206001600160a01b0360015416604051908152f35b3461044f57602036600319011261044f576133bb615409565b6001600160a01b03600b5416803b1561044f575f80916024604051809481937fcd962a0600000000000000000000000000000000000000000000000000000000835260043560048401525af180156104445761043857005b3461044f57602036600319011261044f5761342c614e87565b613434615409565b6001600160a01b03600d541690813b1561044f576001600160a01b0360245f92836040519586948593630787a21360e51b85521660048401525af180156104445761043857005b3461044f57602036600319011261044f57613494614ff0565b61349c615409565b156134f1576001600160a01b0360085416803b1561044f575f80916004604051809481937f3f4ba83a0000000000000000000000000000000000000000000000000000000083525af180156104445761043857005b6001600160a01b0360085416803b1561044f575f8091600460405180948193638456cb5960e01b83525af180156104445761043857005b3461044f5761353636614ec9565b61353e615478565b808303610997575f5b83811061355057005b6001600160a01b03600a54169061356b6107ef828789615021565b613576828587615021565b3560ff8116810361044f57833b1561044f57604051633b39a71f60e11b81526001600160a01b0392909216600483015260ff166024820152915f908390604490829084905af1918215610444576001926135d2575b5001613547565b5f6135dc91614fff565b866135cb565b3461044f57602036600319011261044f57613609336001600160a01b035f5416331461523b565b6001600160a01b03600e5416803b1561044f575f80916024604051809481937ff8f1c1ea00000000000000000000000000000000000000000000000000000000835260043560048401525af180156104445761043857005b3461044f57602036600319011261044f5761367a614e87565b613682615409565b6001600160a01b036005541690813b1561044f576001600160a01b0360245f928360405195869485937fc42cf5350000000000000000000000000000000000000000000000000000000085521660048401525af180156104445761043857005b3461044f575f36600319011261044f5760206001600160a01b0360055416604051908152f35b3461044f5761371636614ec9565b61371e615478565b808303610997575f5b83811061373057005b6001600160a01b03600b54169061374b6107ef828789615021565b613756828587615021565b35833b1561044f576040517f407c301e0000000000000000000000000000000000000000000000000000000081526001600160a01b039290921660048301526024820152915f908390604490829084905af1918215610444576001926137be575b5001613727565b5f6137c891614fff565b866137b7565b3461044f575f36600319011261044f5760206001600160a01b0360085416604051908152f35b3461044f576101e036600319011261044f577ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005460ff8160401c16159067ffffffffffffffff811680159081613df0575b6001149081613de6575b159081613ddd575b50613db5578160017fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000008316177ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0055613d60575b506001600160a01b036138bb61516a565b166001600160a01b03195f5416175f556001600160a01b036138db615180565b166001600160a01b031960015416176001556001600160a01b036138fd615045565b166001600160a01b031960055416176005556001600160a01b0361391f61505b565b166001600160a01b031960065416176006556001600160a01b03613941615071565b166001600160a01b031960075416176007556001600160a01b03613963615087565b166001600160a01b031960085416176008556001600160a01b0361398561509d565b166001600160a01b031960095416176009556001600160a01b036139a76150b3565b166001600160a01b0319600a541617600a556001600160a01b036139c96150c9565b166001600160a01b0319600b541617600b556001600160a01b036139eb6150e0565b166001600160a01b0319600c541617600c556001600160a01b03613a0d6150f7565b166001600160a01b0319600d541617600d556001600160a01b03613a2f61510e565b166001600160a01b0319600e541617600e556001600160a01b03613a51615125565b166001600160a01b031960025416176002556001600160a01b03613a7361513c565b166001600160a01b031960035416176003556001600160a01b03613a95615153565b166001600160a01b03196004541617600455613aaf615180565b613ab8816155f1565b613cdf575b50613ac6615180565b613acf816156c2565b613c5e575b50613add615180565b613ae68161578e565b613bfd575b50613af461516a565b613afd8161578e565b613b9c575b50613b0957005b7fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054167ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00557fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602060405160018152a1005b5f80527fc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e82371705932000602052613bf6906001600160a01b03167f615f0f9e84155bea8cc509fe18befeb1baf65611e38a6ba60964480fb29dfd446159dd565b5081613b02565b5f80527fc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e82371705932000602052613c57906001600160a01b03167f615f0f9e84155bea8cc509fe18befeb1baf65611e38a6ba60964480fb29dfd446159dd565b5081613aeb565b7fb3072e349cf62590698516830b9ea81d68c974027ccbf3c77e3d2a88743208e55f527fc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e82371705932000602052613cd8906001600160a01b03167f568bf0ecd8b65132af5e1d2c8b382a2e7790e9402475a0f5f035ae6ee744a97b6159dd565b5081613ad4565b7f0cee480c05aeabaa18fb824cd297ccabddb1b1a9a83b28d3f07e85c0cd25c4595f527fc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e82371705932000602052613d59906001600160a01b03167f804fa6144f67033cfe22eb2979e6ed2f1b6bf3f1941d7f1fa12d43ba65e665046159dd565b5081613abd565b7fffffffffffffffffffffffffffffffffffffffffffffff0000000000000000001668010000000000000001177ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0055816138aa565b7ff92ee8a9000000000000000000000000000000000000000000000000000000005f5260045ffd5b90501583613857565b303b15915061384f565b839150613845565b3461044f575f36600319011261044f5760206001600160a01b03600b5416604051908152f35b3461044f57602036600319011261044f57613e37614e87565b613e4d336001600160a01b035f5416331461523b565b6001600160a01b03600a541690813b1561044f576001600160a01b0360245f928360405195869485937fa42dce800000000000000000000000000000000000000000000000000000000085521660048401525af180156104445761043857005b3461044f57602036600319011261044f57613ec6615409565b6001600160a01b0360065416803b1561044f575f80916024604051809481937fd47ffef100000000000000000000000000000000000000000000000000000000835260043560048401525af180156104445761043857005b3461044f57602036600319011261044f57613f37614e87565b5f546001600160a01b0380821692613f513385331461523b565b16809214613f68576001600160a01b031916175f55005b7fcb105135000000000000000000000000000000000000000000000000000000005f5260045ffd5b3461044f57604036600319011261044f57613fa9614e9d565b336001600160a01b03821603613fc5576104429060043561559e565b7f6697b232000000000000000000000000000000000000000000000000000000005f5260045ffd5b3461044f57606036600319011261044f57614006614e87565b61400e614e9d565b906044358060020b810361044f57614024615409565b6001600160a01b0360055416803b1561044f576040517fe48bcc7d0000000000000000000000000000000000000000000000000000000081526001600160a01b03938416600482015293909216602484015260020b60448301525f90829081838160648101610428565b3461044f57604036600319011261044f576104426004356140ad614e9d565b906140e66106cd825f527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602052600160405f20015490565b615547565b3461044f57602036600319011261044f57614112336001600160a01b035f5416331461523b565b6001600160a01b03600e5416803b1561044f575f80916024604051809481937fd8e2d8f300000000000000000000000000000000000000000000000000000000835260043560048401525af180156104445761043857005b3461044f57602036600319011261044f57614183615409565b6001600160a01b03600d5416803b1561044f575f80916024604051809481937fd8e0d20c00000000000000000000000000000000000000000000000000000000835260043560048401525af180156104445761043857005b3461044f57602036600319011261044f5760206142256004355f527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602052600160405f20015490565b604051908152f35b3461044f57604036600319011261044f57614246614e87565b60243590811515820361044f5761425b615409565b6001600160a01b03600b541691823b1561044f576040517fe0bd111d0000000000000000000000000000000000000000000000000000000081526001600160a01b03909216600483015215156024820152905f90829081838160448101610428565b3461044f575f806142cd36614f8c565b92916142e8949194336001600160a01b03845416331461523b565b60405184868237828186810182815203925af13d1561438f573d67ffffffffffffffff811161437b5760405190614329601f8201601f191660200183614fff565b81525f60203d92013e5b1561433a57005b6143776040519283927f4715803300000000000000000000000000000000000000000000000000000000845260206004850152602484019161533d565b0390fd5b634e487b7160e01b5f52604160045260245ffd5b614333565b3461044f576101e036600319011261044f576143bc336001600160a01b035f5416331461523b565b6001600160a01b036143cc615045565b166001600160a01b031960055416176005556001600160a01b036143ee61505b565b166001600160a01b031960065416176006556001600160a01b03614410615071565b166001600160a01b031960075416176007556001600160a01b03614432615087565b166001600160a01b031960085416176008556001600160a01b0361445461509d565b166001600160a01b031960095416176009556001600160a01b036144766150b3565b166001600160a01b0319600a541617600a556001600160a01b036144986150c9565b166001600160a01b0319600b541617600b556001600160a01b036144ba6150e0565b166001600160a01b0319600c541617600c556001600160a01b036144dc6150f7565b166001600160a01b0319600d541617600d556001600160a01b036144fe61510e565b166001600160a01b0319600e541617600e556001600160a01b03614520615125565b166001600160a01b031960025416176002556001600160a01b0361454261513c565b166001600160a01b031960035416176003556001600160a01b03614564615153565b166001600160a01b031960045416176004555f80f35b3461044f57602036600319011261044f57614593614e87565b61459b615409565b6001600160a01b036007541690813b1561044f576001600160a01b0360245f928360405195869485937f2aeb8f220000000000000000000000000000000000000000000000000000000085521660048401525af180156104445761043857005b3461044f575f36600319011261044f5760206001600160a01b0360035416604051908152f35b3461044f57604036600319011261044f5761463a614e87565b614642615409565b6001600160a01b0360055416803b1561044f57604051635824780d60e01b81526001600160a01b03831660048201526024803590820152905f90829081838160448101610428565b3461044f5761469836614f1b565b9190936146a6959395615478565b8181148061481d575b15610997575f5b8181106146bf57005b6146cd610837828689615021565b1561477b576001600160a01b03600a5416906146ed6107ef828589615021565b916147016146fc83878c615021565b61532d565b92813b1561044f5760446001600160a01b03915f809462ffffff60405198899687957fba364c3d0000000000000000000000000000000000000000000000000000000087521660048601521660248401525af19182156104445760019261476b575b505b016146b6565b5f61477591614fff565b88614763565b6001600160a01b03600b5416906147966107ef828589615021565b916147a56146fc83878c615021565b92813b1561044f5760446001600160a01b03915f809462ffffff60405198899687957fa93a897d0000000000000000000000000000000000000000000000000000000087521660048601521660248401525af19182156104445760019261480d575b50614765565b5f61481791614fff565b88614807565b508282146146af565b3461044f5761483436614ec9565b929161483e615409565b838103610997576001600160a01b036008541690813b1561044f575f8094610428604051978896879586947f353140d0000000000000000000000000000000000000000000000000000000008652600486016152c5565b3461044f576101a036600319011261044f576148af614e87565b6148b7614e9d565b6148bf614eb3565b916064356001600160a01b03811680910361044f576084356001600160a01b03811680910361044f5760a4356001600160a01b03811680910361044f5760c4356001600160a01b03811680910361044f5760e4356001600160a01b03811680910361044f57610104356001600160a01b03811680910361044f5761012435916001600160a01b03831680930361044f5761014435936001600160a01b03851680950361044f5761016435956001600160a01b03871680970361044f5761018435976001600160a01b03891680990361044f576149a7336001600160a01b035f5416331461523b565b6001600160a01b0360055416998a3b1561044f576040519d8e809e819e7f2fdd983d0000000000000000000000000000000000000000000000000000000083526001600160a01b031660048301526001600160a01b031690602401526001600160a01b031660448d015260648c015260848b015260a48a015260c489015260e48801526101048701526101248601526101448501526101648401526101848301525a925f6101a4928195f180156104445761043857005b3461044f575f36600319011261044f5760206001600160a01b0360065416604051908152f35b3461044f57602036600319011261044f57614a9d614e87565b614ab3336001600160a01b035f5416331461523b565b6001600160a01b03600a541690813b1561044f576001600160a01b0360245f928360405195869485937f4bc2a6570000000000000000000000000000000000000000000000000000000085521660048401525af180156104445761043857005b3461044f57602036600319011261044f576004357fffffffff00000000000000000000000000000000000000000000000000000000811680910361044f57807f5a05180f0000000000000000000000000000000000000000000000000000000060209214908115614b8a575b506040519015158152f35b7f7965db0b00000000000000000000000000000000000000000000000000000000811491508115614bbd575b5082614b7f565b7f01ffc9a70000000000000000000000000000000000000000000000000000000091501482614bb6565b3461044f57602036600319011261044f5760043567ffffffffffffffff811161044f57614c18903690600401614e56565b614c20615409565b6001600160a01b03600554169160405190631ed2419560e01b8252602082600481875afa918215610444575f92614e22575b506001820180921161221d575f5b838110614c6957005b614c776107ef828685615021565b6040517feb9019d40000000000000000000000000000000000000000000000000000000081526001600160a01b0382166004820152602481018590529091905f816044818a5afa908115610444575f905f92614d6f575b5051159081614d65575b5015614d3057853b1561044f576001600160a01b0360405192636b8ab97d60e01b84521660048301525f82602481838a5af191821561044457600192614d20575b5001614c60565b5f614d2a91614fff565b86614d19565b6001600160a01b03827f8b033e4f000000000000000000000000000000000000000000000000000000005f521660045260245ffd5b9050511587614cd8565b9150503d805f833e614d818183614fff565b81019060408183031261044f57805167ffffffffffffffff811161044f5782614dab9183016151d6565b9060208101519067ffffffffffffffff821161044f57019180601f8401121561044f578251614dd9816151aa565b93614de76040519586614fff565b81855260208086019260051b82010192831161044f57602001905b828210614e125750505088614cce565b8151815260209182019101614e02565b9091506020813d602011614e4e575b81614e3e60209383614fff565b8101031261044f57519084614c52565b3d9150614e31565b9181601f8401121561044f5782359167ffffffffffffffff831161044f576020808501948460051b01011161044f57565b600435906001600160a01b038216820361044f57565b602435906001600160a01b038216820361044f57565b604435906001600160a01b038216820361044f57565b604060031982011261044f5760043567ffffffffffffffff811161044f5781614ef491600401614e56565b929092916024359067ffffffffffffffff821161044f57614f1791600401614e56565b9091565b606060031982011261044f5760043567ffffffffffffffff811161044f5781614f4691600401614e56565b9290929160243567ffffffffffffffff811161044f5781614f6991600401614e56565b929092916044359067ffffffffffffffff821161044f57614f1791600401614e56565b604060031982011261044f576004356001600160a01b038116810361044f579160243567ffffffffffffffff811161044f5760040182601f8201121561044f5780359267ffffffffffffffff841161044f576020848184019301011161044f579190565b60043590811515820361044f57565b90601f8019910116810190811067ffffffffffffffff82111761437b57604052565b91908110156150315760051b0190565b634e487b7160e01b5f52603260045260245ffd5b6044356001600160a01b038116810361044f5790565b6064356001600160a01b038116810361044f5790565b6084356001600160a01b038116810361044f5790565b60a4356001600160a01b038116810361044f5790565b60c4356001600160a01b038116810361044f5790565b60e4356001600160a01b038116810361044f5790565b610104356001600160a01b038116810361044f5790565b610164356001600160a01b038116810361044f5790565b6101a4356001600160a01b038116810361044f5790565b6101c4356001600160a01b038116810361044f5790565b610124356001600160a01b038116810361044f5790565b610144356001600160a01b038116810361044f5790565b610184356001600160a01b038116810361044f5790565b6004356001600160a01b038116810361044f5790565b6024356001600160a01b038116810361044f5790565b356001600160a01b038116810361044f5790565b67ffffffffffffffff811161437b5760051b60200190565b51906001600160a01b038216820361044f57565b9080601f8301121561044f5781516151ed816151aa565b926151fb6040519485614fff565b81845260208085019260051b82010192831161044f57602001905b8282106152235750505090565b60208091615230846151c2565b815201910190615216565b156152435750565b6001600160a01b03907fc483b14a000000000000000000000000000000000000000000000000000000005f521660045260245ffd5b916020908281520191905f905b8082106152925750505090565b9091928335906001600160a01b038216820361044f57602080916001600160a01b03600194168152019401920190615285565b906152de90602093959495604084526040840191615278565b90828183039101528281520191905f905b8082106152fc5750505090565b90919283359081151580920361044f576020816001938293520194019201906152ef565b35801515810361044f5790565b3562ffffff8116810361044f5790565b908060209392818452848401375f828201840152601f01601f1916010190565b9081602091031261044f57516001600160a01b038116810361044f5790565b9081602091031261044f5751801515810361044f5790565b80518210156150315760209160051b010190565b8181029291811591840414171561221d57565b81156153c5570490565b634e487b7160e01b5f52601260045260245ffd5b9190820391821161221d57565b6040906001600160a01b036154069593168152816020820152019161533d565b90565b335f9081527f3b05fb06f7501e09d6a8a50c59dac59cd7c8dab47e848ae345bfca5e4d5d9e3c602052604090205460ff161561544157565b63e2517d3f60e01b5f52336004527fb3072e349cf62590698516830b9ea81d68c974027ccbf3c77e3d2a88743208e560245260445ffd5b335f9081527f9eacbbea19e14d84ae6fc89bafe3fe4134e0cfcdae6894d6d7239131d0cd8325602052604090205460ff16156154b057565b63e2517d3f60e01b5f52336004527f0cee480c05aeabaa18fb824cd297ccabddb1b1a9a83b28d3f07e85c0cd25c45960245260445ffd5b805f527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b62680060205260405f206001600160a01b0333165f5260205260ff60405f205416156155315750565b63e2517d3f60e01b5f523360045260245260445ffd5b6155518282615838565b918261555c57505090565b61559a915f527fc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e823717059320006020526001600160a01b0360405f209116906159dd565b5090565b6155a88282615905565b91826155b357505090565b61559a915f527fc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e823717059320006020526001600160a01b0360405f20911690615a4c565b6001600160a01b0381165f9081527f9eacbbea19e14d84ae6fc89bafe3fe4134e0cfcdae6894d6d7239131d0cd8325602052604090205460ff166156bd576001600160a01b03165f8181527f9eacbbea19e14d84ae6fc89bafe3fe4134e0cfcdae6894d6d7239131d0cd832560205260408120805460ff191660011790553391907f0cee480c05aeabaa18fb824cd297ccabddb1b1a9a83b28d3f07e85c0cd25c459907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9080a4600190565b505f90565b6001600160a01b0381165f9081527f3b05fb06f7501e09d6a8a50c59dac59cd7c8dab47e848ae345bfca5e4d5d9e3c602052604090205460ff166156bd576001600160a01b03165f8181527f3b05fb06f7501e09d6a8a50c59dac59cd7c8dab47e848ae345bfca5e4d5d9e3c60205260408120805460ff191660011790553391907fb3072e349cf62590698516830b9ea81d68c974027ccbf3c77e3d2a88743208e5907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9080a4600190565b6001600160a01b0381165f9081527fb7db2dd08fcb62d0c9e08c51941cae53c267786a0b75803fb7960902fc8ef97d602052604090205460ff166156bd576001600160a01b03165f8181527fb7db2dd08fcb62d0c9e08c51941cae53c267786a0b75803fb7960902fc8ef97d60205260408120805460ff191660011790553391907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8180a4600190565b805f527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b62680060205260405f206001600160a01b0383165f5260205260ff60405f205416155f146158ff57805f527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b62680060205260405f206001600160a01b0383165f5260205260405f20600160ff198254161790556001600160a01b03339216907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d5f80a4600190565b50505f90565b805f527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b62680060205260405f206001600160a01b0383165f5260205260ff60405f2054165f146158ff57805f527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b62680060205260405f206001600160a01b0383165f5260205260405f2060ff1981541690556001600160a01b03339216907ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b5f80a4600190565b8054821015615031575f5260205f2001905f90565b6001810190825f528160205260405f2054155f14615a455780546801000000000000000081101561437b57615a32615a1c8260018794018555846159c8565b819391549060031b91821b915f19901b19161790565b905554915f5260205260405f2055600190565b5050505f90565b906001820191815f528260205260405f20548015155f14615b09575f19810181811161221d5782545f1981019190821161221d57818103615ad4575b50505080548015615ac0575f190190615aa182826159c8565b8154905f199060031b1b19169055555f526020525f6040812055600190565b634e487b7160e01b5f52603160045260245ffd5b615af4615ae4615a1c93866159c8565b90549060031b1c928392866159c8565b90555f528360205260405f20555f8080615a88565b505050505f9056fea26469706673582212203e8ca5dac91c130d37235afa75377bfe1084fea2579d0a5b385d9ede7a08567564736f6c634300081c0033

Block Transaction Gas Used Reward
view all blocks ##produced##

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits

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.