Sonic Blaze Testnet

Contract

0x800516F78e730D1e2c671EFb0071254A7517d046

Overview

S Balance

Sonic Blaze LogoSonic Blaze LogoSonic Blaze Logo0 S

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

Latest 25 internal transactions (View All)

Parent Transaction Hash Block From To
53169332024-12-19 11:33:0126 mins ago1734607981
0x800516F7...A7517d046
0 S
53169332024-12-19 11:33:0126 mins ago1734607981
0x800516F7...A7517d046
0 S
53169332024-12-19 11:33:0126 mins ago1734607981
0x800516F7...A7517d046
0 S
53169332024-12-19 11:33:0126 mins ago1734607981
0x800516F7...A7517d046
0 S
53169332024-12-19 11:33:0126 mins ago1734607981
0x800516F7...A7517d046
0 S
53169332024-12-19 11:33:0126 mins ago1734607981
0x800516F7...A7517d046
0 S
53169332024-12-19 11:33:0126 mins ago1734607981
0x800516F7...A7517d046
0 S
53169332024-12-19 11:33:0126 mins ago1734607981
0x800516F7...A7517d046
0 S
53169332024-12-19 11:33:0126 mins ago1734607981
0x800516F7...A7517d046
0 S
53169332024-12-19 11:33:0126 mins ago1734607981
0x800516F7...A7517d046
0 S
53169332024-12-19 11:33:0126 mins ago1734607981
0x800516F7...A7517d046
0 S
53169332024-12-19 11:33:0126 mins ago1734607981
0x800516F7...A7517d046
0 S
53169332024-12-19 11:33:0126 mins ago1734607981
0x800516F7...A7517d046
0 S
53169332024-12-19 11:33:0126 mins ago1734607981
0x800516F7...A7517d046
0 S
53169332024-12-19 11:33:0126 mins ago1734607981
0x800516F7...A7517d046
0 S
53169332024-12-19 11:33:0126 mins ago1734607981
0x800516F7...A7517d046
0 S
53169332024-12-19 11:33:0126 mins ago1734607981
0x800516F7...A7517d046
0 S
53165962024-12-19 11:31:0128 mins ago1734607861
0x800516F7...A7517d046
0 S
53165962024-12-19 11:31:0128 mins ago1734607861
0x800516F7...A7517d046
0 S
53120102024-12-19 11:03:0056 mins ago1734606180
0x800516F7...A7517d046
0 S
53120102024-12-19 11:03:0056 mins ago1734606180
0x800516F7...A7517d046
0 S
53120102024-12-19 11:03:0056 mins ago1734606180
0x800516F7...A7517d046
0 S
53120102024-12-19 11:03:0056 mins ago1734606180
0x800516F7...A7517d046
0 S
53120102024-12-19 11:03:0056 mins ago1734606180
0x800516F7...A7517d046
0 S
53120102024-12-19 11:03:0056 mins ago1734606180
0x800516F7...A7517d046
0 S
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
VoterV3

Compiler Version
v0.8.13+commit.abaa5c0e

Optimization Enabled:
Yes with 1 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 23 : VoterV3.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

import "./libraries/Math.sol";
import "./libraries/Constants.sol";
import "./interfaces/IBribe.sol";
import "./interfaces/IBribeFactory.sol";
import "./interfaces/IGauge.sol";
import "./interfaces/IGaugeFactory.sol";
import "./interfaces/IERC20.sol";
import "./interfaces/IMinter.sol";
import "./interfaces/IPairInfo.sol";
import "./interfaces/IPairFactory.sol";
import "./interfaces/IVotingEscrow.sol";
import "./interfaces/IPermissionsRegistry.sol";
import "./interfaces/IAlgebraFactory.sol";
import "./interfaces/IMasterchef.sol";

import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";

interface IHypervisor {
    function pool() external view returns (address);
}

contract VoterV3 is OwnableUpgradeable, ReentrancyGuardUpgradeable {
    using SafeERC20Upgradeable for IERC20Upgradeable;

    uint256 internal firstActiveEpoch;

    address public _ve; // the ve token that governs these contracts
    address public factory; // classic stable and volatile Pair Factory
    address[] internal _factories; // Array with all the pair factories
    address internal base; // $SWPx token
    address[] internal _gaugeFactories; // array with all the gauge factories
    address public bribefactory; // bribe factory (internal and external)
    address public minter; // minter mints $SWPx each epoch
    address public permissionRegistry; // registry to check accesses
    address[] public pools; // all pools viable for incentives

    address public masterChef;

    uint256 internal index; // gauge index
    uint256 internal immutable DURATION = Constants.EPOCH_LENGTH; // rewards are released over 7 days
    uint256 public VOTE_DELAY; // delay between votes in seconds
    uint256 public immutable MAX_VOTE_DELAY = Constants.EPOCH_LENGTH; // Max vote delay allowed

    mapping(uint256 => uint256) internal timestampToIndex;
    mapping(address => uint256) internal supplyIndex; // gauge    => index
    mapping(address => uint256) public claimable; // gauge    => claimable $SWPx
    mapping(address => address) public gauges; // pool     => gauge
    mapping(address => uint256) public gaugesDistributionTimestmap; // gauge    => last Distribution Time
    mapping(address => address) public poolForGauge; // gauge    => pool
    mapping(address => address) public internal_bribes; // gauge    => internal bribe (only fees)
    mapping(address => address) public external_bribes; // gauge    => external bribe (real bribes)
    mapping(uint256 => mapping(address => uint256)) public votes; // nft      => pool     => votes
    mapping(uint256 => address[]) public poolVote; // nft      => pools
    mapping(uint256 => mapping(address => uint256)) internal weightsPerEpoch; // timestamp => pool => weights
    mapping(uint256 => uint256) internal totalWeightsPerEpoch; // timestamp => total weights
    mapping(uint256 => uint256) public lastVoted; // nft      => timestamp of last vote
    mapping(address => bool) public isGauge; // gauge    => boolean [is a gauge?]
    mapping(address => bool) public isAlive; // gauge    => boolean [is the gauge alive?]
    mapping(address => bool) public isFactory; // factory  => boolean [the pair factory exists?]
    mapping(address => bool) public isGaugeFactory; // g.factory=> boolean [the gauge factory exists?]
    mapping(address => uint256) public hasGaugeKilled; // gauge => epoch [when gauge killed, if > 0; 0 - gauge is alive]

    event GaugeCreated(
        address indexed gauge,
        address creator,
        address internal_bribe,
        address indexed external_bribe,
        address indexed pool
    );
    event GaugeKilled(address indexed gauge);
    event GaugeRevived(address indexed gauge);
    event Voted(
        address indexed voter,
        uint256 tokenId,
        uint256 weight,
        address pool
    );
    event Abstained(uint256 tokenId);
    event NotifyReward(
        address indexed sender,
        address indexed reward,
        uint256 amount
    );
    event DistributeReward(
        address indexed sender,
        address indexed gauge,
        uint256 amount
    );

    event SetMinter(address indexed old, address indexed latest);
    event SetBribeFactory(address indexed old, address indexed latest);
    event SetPairFactory(address indexed old, address indexed latest);
    event SetPermissionRegistry(address indexed old, address indexed latest);
    event SetGaugeFactory(address indexed old, address indexed latest);
    event SetBribeFor(
        bool isInternal,
        address indexed old,
        address indexed latest,
        address indexed gauge
    );
    event SetVoteDelay(uint256 old, uint256 latest);
    event AddFactories(
        address indexed pairfactory,
        address indexed gaugefactory
    );

    constructor() {}

    function initialize(
        address __ve,
        address _pairFactory,
        address _gaugeFactory,
        address _bribes,
        address _masterChef
    ) public initializer {
        __Ownable_init();
        __ReentrancyGuard_init();

        _ve = __ve;
        base = IVotingEscrow(__ve).token();

        _factories.push(_pairFactory);
        isFactory[_pairFactory] = true;

        _gaugeFactories.push(_gaugeFactory);
        isGaugeFactory[_gaugeFactory] = true;

        bribefactory = _bribes;

        minter = msg.sender;
        permissionRegistry = msg.sender;

        masterChef = _masterChef;
    }

    /* -----------------------------------------------------------------------------
    --------------------------------------------------------------------------------
    --------------------------------------------------------------------------------
                                    MODIFIERS
    --------------------------------------------------------------------------------
    --------------------------------------------------------------------------------
    ----------------------------------------------------------------------------- */

    modifier VoterAdmin() {
        require(
            IPermissionsRegistry(permissionRegistry).hasRole(
                "VOTER_ADMIN",
                msg.sender
            ),
            "VOTER_ADMIN"
        );
        _;
    }

    modifier Governance() {
        require(
            IPermissionsRegistry(permissionRegistry).hasRole(
                "GOVERNANCE",
                msg.sender
            ),
            "GOVERNANCE"
        );
        _;
    }

    /// @notice initialize the voter contract
    // / @param  _tokens array of tokens to whitelist
    /// @param  _minter the minter of $SWPx
    function _init(address _permissionsRegistry, address _minter) external {
        require(
            msg.sender == minter ||
                IPermissionsRegistry(permissionRegistry).hasRole(
                    "VOTER_ADMIN",
                    msg.sender
                )
        );
        require(firstActiveEpoch == 0);
        minter = _minter;
        permissionRegistry = _permissionsRegistry;
        firstActiveEpoch = _epochTimestamp();
    }

    /* -----------------------------------------------------------------------------
    --------------------------------------------------------------------------------
    --------------------------------------------------------------------------------
                                    VoterAdmin
    --------------------------------------------------------------------------------
    --------------------------------------------------------------------------------
    ----------------------------------------------------------------------------- */

    /// @notice set vote delay in seconds
    function setVoteDelay(uint256 _delay) external VoterAdmin {
        require(_delay != VOTE_DELAY, "already set");
        require(_delay <= MAX_VOTE_DELAY, "max delay");
        emit SetVoteDelay(VOTE_DELAY, _delay);
        VOTE_DELAY = _delay;
    }

    /// @notice Set a new Minter
    function setMinter(address _minter) external VoterAdmin {
        require(_minter != address(0), "addr0");
        require(_minter.code.length > 0, "!contract");
        emit SetMinter(minter, _minter);
        minter = _minter;
    }

    /// @notice Set a new Bribe Factory
    function setBribeFactory(address _bribeFactory) external VoterAdmin {
        require(_bribeFactory.code.length > 0, "!contract");
        require(_bribeFactory != address(0), "addr0");
        emit SetBribeFactory(bribefactory, _bribeFactory);
        bribefactory = _bribeFactory;
    }

    /// @notice Set a new Pair Factory
    function setPairFactory(address _factory) external VoterAdmin {
        factory = _factory;
    }

    /// @notice Set a new PermissionRegistry
    function setPermissionsRegistry(
        address _permissionRegistry
    ) external VoterAdmin {
        require(_permissionRegistry.code.length > 0, "!contract");
        require(_permissionRegistry != address(0), "addr0");
        emit SetPermissionRegistry(permissionRegistry, _permissionRegistry);
        permissionRegistry = _permissionRegistry;
    }

    /// @notice Set a new bribes for a given gauge
    function setNewBribes(
        address _gauge,
        address _internal,
        address _external
    ) external VoterAdmin {
        require(isGauge[_gauge], "!gauge");
        require(_gauge.code.length > 0, "!contract");
        _setInternalBribe(_gauge, _internal);
        _setExternalBribe(_gauge, _external);
    }

    /// @notice Set a new internal bribe for a given gauge
    function setInternalBribeFor(
        address _gauge,
        address _internal
    ) external VoterAdmin {
        require(isGauge[_gauge], "!gauge");
        _setInternalBribe(_gauge, _internal);
    }

    /// @notice Set a new External bribe for a given gauge
    function setExternalBribeFor(
        address _gauge,
        address _external
    ) external VoterAdmin {
        require(isGauge[_gauge], "!gauge");
        _setExternalBribe(_gauge, _external);
    }

    function _setInternalBribe(address _gauge, address _internal) private {
        require(_internal.code.length > 0, "!contract");
        emit SetBribeFor(true, internal_bribes[_gauge], _internal, _gauge);
        internal_bribes[_gauge] = _internal;
    }

    function _setExternalBribe(address _gauge, address _external) private {
        require(_external.code.length > 0, "!contract");
        emit SetBribeFor(false, internal_bribes[_gauge], _external, _gauge);
        external_bribes[_gauge] = _external;
    }

    function addFactory(
        address _pairFactory,
        address _gaugeFactory
    ) external VoterAdmin {
        require(_pairFactory != address(0), "addr0");
        require(_gaugeFactory != address(0), "addr0");
        require(!isFactory[_pairFactory], "fact");
        require(!isGaugeFactory[_gaugeFactory], "gFact");
        //require(_pairFactory.code.length > 0, "!contract");
        require(_gaugeFactory.code.length > 0, "!contract");

        _factories.push(_pairFactory);
        _gaugeFactories.push(_gaugeFactory);
        isFactory[_pairFactory] = true;
        isGaugeFactory[_gaugeFactory] = true;
        emit AddFactories(_pairFactory, _gaugeFactory);
    }

    function replaceFactory(
        address _pairFactory,
        address _gaugeFactory,
        uint256 _pos
    ) external VoterAdmin {
        require(_pairFactory != address(0), "addr0");
        require(_gaugeFactory != address(0), "addr0");
        require(!isFactory[_pairFactory], "fact");
        require(!isGaugeFactory[_gaugeFactory], "gFact");
        address oldPF = _factories[_pos];
        address oldGF = _gaugeFactories[_pos];
        isFactory[oldPF] = false;
        isGaugeFactory[oldGF] = false;

        _factories[_pos] = (_pairFactory);
        _gaugeFactories[_pos] = (_gaugeFactory);
        isFactory[_pairFactory] = true;
        isGaugeFactory[_gaugeFactory] = true;

        emit SetGaugeFactory(oldGF, _gaugeFactory);
        emit SetPairFactory(oldPF, _pairFactory);
    }

    function removeFactory(uint256 _pos) external VoterAdmin {
        address oldPF = _factories[_pos];
        address oldGF = _gaugeFactories[_pos];

        require(isFactory[oldPF], "!fact");
        require(isGaugeFactory[oldGF], "!gFact");
        _factories[_pos] = address(0);
        _gaugeFactories[_pos] = address(0);
        isFactory[oldPF] = false;
        isGaugeFactory[oldGF] = false;
        emit SetGaugeFactory(oldGF, address(0));
        emit SetPairFactory(oldPF, address(0));
    }

    function recoverERC20(address token, uint256 amount) external VoterAdmin {
        IERC20Upgradeable(token).safeTransfer(msg.sender, amount);
    }

    /* -----------------------------------------------------------------------------
    --------------------------------------------------------------------------------
    --------------------------------------------------------------------------------
                                    GOVERNANCE
    --------------------------------------------------------------------------------
    --------------------------------------------------------------------------------
    ----------------------------------------------------------------------------- */

    /// @notice Kill a malicious gauge
    /// @param  _gauge gauge to kill
    function killGauge(address _gauge) external Governance {
        require(isAlive[_gauge], "killed");
        isAlive[_gauge] = false;
        claimable[_gauge] = 0;

        uint _time = _epochTimestamp();
        totalWeightsPerEpoch[_time] -= weightsPerEpoch[_time][poolForGauge[_gauge]]; 

        hasGaugeKilled[_gauge] = _time;


        emit GaugeKilled(_gauge);
    }

    /// @notice Revive a malicious gauge
    /// @param  _gauge gauge to revive
    function reviveGauge(address _gauge) external Governance {
        require(!isAlive[_gauge], "alive");
        require(isGauge[_gauge], 'killed');
        require(_epochTimestamp() > hasGaugeKilled[_gauge], "early");
        isAlive[_gauge] = true;
        delete hasGaugeKilled[_gauge];
        emit GaugeRevived(_gauge);
    }

    /* -----------------------------------------------------------------------------
    --------------------------------------------------------------------------------
    --------------------------------------------------------------------------------
                                    USER INTERACTION
    --------------------------------------------------------------------------------
    --------------------------------------------------------------------------------
    ----------------------------------------------------------------------------- */

    /// @notice Reset the votes of a given TokenID
    function reset(uint256 _tokenId) external nonReentrant {
        _voteDelay(_tokenId);
        require(
            IVotingEscrow(_ve).isApprovedOrOwner(msg.sender, _tokenId),
            "!approved/Owner"
        );
        _reset(_tokenId);
        IVotingEscrow(_ve).abstain(_tokenId);
        lastVoted[_tokenId] = _epochTimestamp() + 1;
    }

    function _reset(uint256 _tokenId) internal {
        address[] storage _poolVote = poolVote[_tokenId];
        uint256 _poolVoteCnt = _poolVote.length;
        uint256 _totalWeight;
        uint256 _time = _epochTimestamp();
        uint256[] memory _votes = new uint256[](_poolVoteCnt);
        address _pool;

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

                if (_votes[i] != 0) {
                    // if user last vote is < than epochTimestamp then votes are 0! IF not underflow occur
                    if (lastVoted[_tokenId] > _time)
                        weightsPerEpoch[_time][_pool] -= _votes[i];

                    votes[_tokenId][_pool] -= _votes[i];

                    if (lastVoted[_tokenId] > _time) {
                        IBribe(internal_bribes[gauges[_pool]])._withdraw(
                            uint256(_votes[i]),
                            _tokenId
                        );
                        IBribe(external_bribes[gauges[_pool]])._withdraw(
                            uint256(_votes[i]),
                            _tokenId
                        );
                    }

                    // if is alive remove _votes, else don't because we already done it in killGauge()
                    if (isAlive[gauges[_pool]]) _totalWeight += _votes[i];
                }
            }
        }

        // if user last vote is < than epochTimestamp then _totalWeight is 0! IF not underflow occur
        if (lastVoted[_tokenId] < _time) _totalWeight = 0;

        totalWeightsPerEpoch[_time] -= _totalWeight;
        delete poolVote[_tokenId];

        emit Abstained(_tokenId);
    }

    /// @notice Recast the saved votes of a given TokenID
    function poke(uint256 _tokenId) external nonReentrant {
        _voteDelay(_tokenId);
        require(
            IVotingEscrow(_ve).isApprovedOrOwner(msg.sender, _tokenId),
            "!approved/Owner"
        );
        address[] memory _poolVote = poolVote[_tokenId];
        uint256 _poolCnt = _poolVote.length;
        uint256[] memory _weights = new uint256[](_poolCnt);

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

        _vote(_tokenId, _poolVote, _weights);
        lastVoted[_tokenId] = _epochTimestamp() + 1;
    }

    /// @notice Vote for pools
    /// @param  _tokenId    veNFT tokenID used to vote
    /// @param  _poolVote   array of LPs addresses to vote  (eg.: [sAMM usdc-usdt   , sAMM dai-usdt, vAMM wsonic-SWPx ,...])
    /// @param  _weights    array of weights for each LPs   (eg.: [10               , 90            , 45             ,...])
    function vote(
        uint256 _tokenId,
        address[] calldata _poolVote,
        uint256[] calldata _weights
    ) external nonReentrant {
        _voteDelay(_tokenId);
        require(
            IVotingEscrow(_ve).isApprovedOrOwner(msg.sender, _tokenId),
            "!approved/Owner"
        );
        require(_poolVote.length == _weights.length, "Pool/Weights length !=");
        _vote(_tokenId, _poolVote, _weights);
        lastVoted[_tokenId] = _epochTimestamp() + 1;
    }

    function _vote(
        uint256 _tokenId,
        address[] memory _poolVote,
        uint256[] memory _weights
    ) internal {
        _reset(_tokenId);
        uint256 _poolCnt = _poolVote.length;
        uint256 _weight = IVotingEscrow(_ve).balanceOfNFT(_tokenId);
        uint256 _totalVoteWeight = 0;
        uint256 _totalWeight = 0;
        uint256 _usedWeight = 0;
        uint256 _time = _epochTimestamp();

        for (uint i = 0; i < _poolCnt; i++) {
            if (isAlive[gauges[_poolVote[i]]])
                _totalVoteWeight += _weights[i];
        }

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

            if (isGauge[_gauge] && isAlive[_gauge]) {
                uint256 _poolWeight = (_weights[i] * _weight) /
                    _totalVoteWeight;

                require(votes[_tokenId][_pool] == 0);
                require(_poolWeight != 0);

                poolVote[_tokenId].push(_pool);
                weightsPerEpoch[_time][_pool] += _poolWeight;

                votes[_tokenId][_pool] += _poolWeight;

                IBribe(internal_bribes[_gauge])._deposit(
                    uint256(_poolWeight),
                    _tokenId
                );
                IBribe(external_bribes[_gauge])._deposit(
                    uint256(_poolWeight),
                    _tokenId
                );

                _usedWeight += _poolWeight;
                _totalWeight += _poolWeight;
                emit Voted(msg.sender, _tokenId, _poolWeight, _pool);
            }
        }
        if (_usedWeight > 0) IVotingEscrow(_ve).voting(_tokenId);
        totalWeightsPerEpoch[_time] += _totalWeight;
    }

    /// @notice claim LP gauge rewards
    function claimRewards(address[] memory _gauges) external {
        for (uint256 i = 0; i < _gauges.length; i++) {
            IGauge(_gauges[i]).getReward(msg.sender);
        }
    }

    /// @notice claim bribes rewards given a TokenID
    function claimBribes(
        address[] memory _bribes,
        address[][] memory _tokens,
        uint256 _tokenId
    ) external {
        require(
            IVotingEscrow(_ve).isApprovedOrOwner(msg.sender, _tokenId),
            "!approved/Owner"
        );
        for (uint256 i = 0; i < _bribes.length; i++) {
            IBribe(_bribes[i]).getRewardForOwner(_tokenId, _tokens[i]);
        }
    }

    /// @notice claim fees rewards given a TokenID
    function claimFees(
        address[] memory _fees,
        address[][] memory _tokens,
        uint256 _tokenId
    ) external {
        require(
            IVotingEscrow(_ve).isApprovedOrOwner(msg.sender, _tokenId),
            "!approved/Owner"
        );
        for (uint256 i = 0; i < _fees.length; i++) {
            IBribe(_fees[i]).getRewardForOwner(_tokenId, _tokens[i]);
        }
    }

    /// @notice claim bribes rewards given an address
    function claimBribes(
        address[] memory _bribes,
        address[][] memory _tokens
    ) external {
        for (uint256 i = 0; i < _bribes.length; i++) {
            IBribe(_bribes[i]).getRewardForAddress(msg.sender, _tokens[i]);
        }
    }

    /// @notice claim fees rewards given an address
    function claimFees(
        address[] memory _bribes,
        address[][] memory _tokens
    ) external {
        for (uint256 i = 0; i < _bribes.length; i++) {
            IBribe(_bribes[i]).getRewardForAddress(msg.sender, _tokens[i]);
        }
    }

    /// @notice check if user can vote
    function _voteDelay(uint256 _tokenId) internal view {
        require(
            block.timestamp > lastVoted[_tokenId] + VOTE_DELAY,
            "ERR: VOTE_DELAY"
        );
    }

    /* -----------------------------------------------------------------------------
    --------------------------------------------------------------------------------
    --------------------------------------------------------------------------------
                                    GAUGE CREATION
    --------------------------------------------------------------------------------
    --------------------------------------------------------------------------------
    ----------------------------------------------------------------------------- */
    /// @notice create multiple gauges
    function createGauges(
        address[] memory _pool,
        uint256[] memory _gaugeTypes
    )
        external
        nonReentrant
        returns (address[] memory, address[] memory, address[] memory)
    {
        require(_pool.length == _gaugeTypes.length, "len mismatch");
        require(_pool.length <= 10, "max 10");
        address[] memory _gauge = new address[](_pool.length);
        address[] memory _int = new address[](_pool.length);
        address[] memory _ext = new address[](_pool.length);

        uint256 i = 0;
        for (i; i < _pool.length; i++) {
            (_gauge[i], _int[i], _ext[i]) = _createGauge(
                _pool[i],
                _gaugeTypes[i]
            );
        }
        return (_gauge, _int, _ext);
    }

    /// @notice create a gauge
    function createGauge(
        address _pool,
        uint256 _gaugeType
    )
        external
        nonReentrant
        returns (
            address _gauge,
            address _internal_bribe,
            address _external_bribe
        )
    {
        (_gauge, _internal_bribe, _external_bribe) = _createGauge(
            _pool,
            _gaugeType
        );
    }

    /// @notice create a gauge
    /// @param  _pool       LP address
    /// @param  _gaugeType  the type of the gauge you want to create
    /// @dev    To create stable/Volatile pair gaugeType = 0, Concentrated liqudity = 1, ...
    ///         Make sure to use the corrcet gaugeType or it will fail

    function _createGauge(
        address _pool,
        uint256 _gaugeType
    )
        internal
        returns (
            address _gauge,
            address _internal_bribe,
            address _external_bribe
        )
    {
        require(
            IPermissionsRegistry(permissionRegistry).hasRole(
                "GOVERNANCE",
                msg.sender
            )
        );
        require(_gaugeType < _factories.length, "gaugetype");
        require(gauges[_pool] == address(0x0), "!exists");
        require(_pool.code.length > 0, "!contract");

        bool isPair;
        address _factory = _factories[_gaugeType];
        address _gaugeFactory = _gaugeFactories[_gaugeType];
        require(_factory != address(0), "addr0");
        require(_gaugeFactory != address(0), "addr0");

        address tokenA = address(0);
        address tokenB = address(0);
        (tokenA) = IPairInfo(_pool).token0();
        (tokenB) = IPairInfo(_pool).token1();

        // for future implementation add isPair() in factory
        if (_gaugeType == 0) {
            isPair = IPairFactory(_factory).isPair(_pool);
        }
        if (_gaugeType == 1) {
            address _pool_factory = IAlgebraFactory(_factory).poolByPair(
                tokenA,
                tokenB
            );
            address _pool_hyper = IHypervisor(_pool).pool();
            require(_pool_hyper == _pool_factory, "wrong tokens");
            isPair = true;
        } else {
            //update
            //isPair = false;
        }

        // create internal and external bribe
        address _owner = IPermissionsRegistry(permissionRegistry)
            .swpxTeamMultisig();
        string memory _type = string.concat(
            "SwapX LP Fees: ",
            IERC20(_pool).symbol()
        );
        _internal_bribe = IBribeFactory(bribefactory).createBribe(
            _owner,
            tokenA,
            tokenB,
            _type
        );

        _type = string.concat("SwapX Incentives: ", IERC20(_pool).symbol());
        _external_bribe = IBribeFactory(bribefactory).createBribe(
            _owner,
            tokenA,
            tokenB,
            _type
        );

        // create gauge
        _gauge = IGaugeFactory(_gaugeFactory).createGaugeV2(
            base,
            _ve,
            _pool,
            address(this),
            _internal_bribe,
            _external_bribe,
            isPair
        );

        // approve spending for $SWPx
        IERC20(base).approve(_gauge, type(uint256).max);

        // save data
        internal_bribes[_gauge] = _internal_bribe;
        external_bribes[_gauge] = _external_bribe;
        gauges[_pool] = _gauge;
        poolForGauge[_gauge] = _pool;
        isGauge[_gauge] = true;
        isAlive[_gauge] = true;
        pools.push(_pool);

        // update index
        supplyIndex[_gauge] = index; // new gauges are set to the default global state

        emit GaugeCreated(
            _gauge,
            msg.sender,
            _internal_bribe,
            _external_bribe,
            _pool
        );
    }

    /* -----------------------------------------------------------------------------
    --------------------------------------------------------------------------------
    --------------------------------------------------------------------------------
                                    VIEW FUNCTIONS
    --------------------------------------------------------------------------------
    --------------------------------------------------------------------------------
    ----------------------------------------------------------------------------- */

    /// @notice view the total length of the pools
    function length() external view returns (uint256) {
        return pools.length;
    }

    /// @notice view the total length of the voted pools given a tokenId
    function poolVoteLength(uint256 tokenId) external view returns (uint256) {
        return poolVote[tokenId].length;
    }

    function factories() external view returns (address[] memory) {
        return _factories;
    }

    function factoryLength() external view returns (uint256) {
        return _factories.length;
    }

    function gaugeFactories() external view returns (address[] memory) {
        return _gaugeFactories;
    }

    function gaugeFactoriesLength() external view returns (uint256) {
        return _gaugeFactories.length;
    }

    function weights(address _pool) public view returns (uint256) {
        uint256 _time = _epochTimestamp();
        return weightsPerEpoch[_time][_pool];
    }

    function weightsAt(
        address _pool,
        uint256 _time
    ) public view returns (uint256) {
        return weightsPerEpoch[_time][_pool];
    }

    function totalWeight() public view returns (uint256) {
        uint256 _time = _epochTimestamp();
        return totalWeightsPerEpoch[_time];
    }

    function totalWeightAt(uint256 _time) public view returns (uint256) {
        return totalWeightsPerEpoch[_time];
    }

    function _epochTimestamp() public view returns (uint256) {
        uint256 active_period = IMinter(minter).active_period();
        require(active_period != 0, "Not started epochs");
        return active_period;
    }

    function indexAt(uint256 _time) public view returns (uint256) {
        return timestampToIndex[_time];
    }
    /* -----------------------------------------------------------------------------
    --------------------------------------------------------------------------------
    --------------------------------------------------------------------------------
                                    DISTRIBUTION
    --------------------------------------------------------------------------------
    --------------------------------------------------------------------------------
    ----------------------------------------------------------------------------- */

    /// @notice notify reward amount for gauge
    /// @dev    the function is called by the minter each epoch. Anyway anyone can top up some extra rewards.
    /// @param  amount  amount to distribute
    function notifyRewardAmount(uint256 amount) external {
        require(msg.sender == minter, "!minter");

        uint256 _time = _epochTimestamp() - Constants.EPOCH_LENGTH;

        uint256 _totalWeight = totalWeightAt(_time); // minter call notify after updates active_period, loads votes - 1 week

        uint256 _ratio = 0;

        if (_totalWeight > 0) {
            IERC20Upgradeable(base).safeTransferFrom(
                msg.sender,
                address(this),
                amount
            );
            _ratio = (amount * 1e18) / _totalWeight; // 1e18 adjustment is removed during claim
        }
        if (_ratio > 0) {
            index += _ratio;
            timestampToIndex[_time] = index;
        }

        emit NotifyReward(msg.sender, base, amount);
    }

    /// @notice distribute the LP Fees to the internal bribes
    /// @param  _gauges  gauge address where to claim the fees
    /// @dev    the gauge is the owner of the LPs so it has to claim
    function distributeFees(address[] memory _gauges) external {
        for (uint256 i = 0; i < _gauges.length; i++) {
            if (isGauge[_gauges[i]] && isAlive[_gauges[i]]) {
                IGauge(_gauges[i]).claimFees();
            }
        }
    }

    /// @notice Distribute the emission for ALL gauges
    function distributeAll() external nonReentrant {
        IMinter(minter).update_period();

        IMasterchef(masterChef).updatePool();

        uint256 x = 0;
        uint256 stop = pools.length;
        for (x; x < stop; x++) {
            _distribute(gauges[pools[x]]);
        }
    }

    /// @notice distribute the emission for N gauges
    /// @param  start   start index point of the pools array
    /// @param  finish  finish index point of the pools array
    /// @dev    this function is used in case we have too many pools and gasLimit is reached
    function distribute(uint256 start, uint256 finish) public nonReentrant {
        IMinter(minter).update_period();
        IMasterchef(masterChef).updatePool();
        for (uint256 x = start; x < finish; x++) {
            _distribute(gauges[pools[x]]);
        }
    }

    /// @notice distribute reward onyl for given gauges
    /// @dev    this function is used in case some distribution fails
    function distribute(address[] memory _gauges) external nonReentrant {
        IMinter(minter).update_period();
        IMasterchef(masterChef).updatePool();
        for (uint256 x = 0; x < _gauges.length; x++) {
            _distribute(_gauges[x]);
        }
    }

   /// @notice distribute the emission
    function _distribute(address _gauge) internal {
        uint256 lastTimestamp = gaugesDistributionTimestmap[_gauge];
        uint256 currentTimestamp = _epochTimestamp();
        if(lastTimestamp < currentTimestamp){
            _updateForAfterDistribution(_gauge); // should set claimable to 0 if killed

            uint256 _claimable = claimable[_gauge];

            // distribute only if claimable is > 0, currentEpoch != lastepoch and gauge is alive
            if (_claimable > 0 && isAlive[_gauge]) {
                claimable[_gauge] = 0;
                gaugesDistributionTimestmap[_gauge] = currentTimestamp;
                IGauge(_gauge).notifyRewardAmount(base, _claimable);
                emit DistributeReward(msg.sender, _gauge, _claimable);
            }
        }
    }

    /* -----------------------------------------------------------------------------
    --------------------------------------------------------------------------------
    --------------------------------------------------------------------------------
                                    HELPERS
    --------------------------------------------------------------------------------
    --------------------------------------------------------------------------------
    ----------------------------------------------------------------------------- */

    /// @notice update info for gauges
    /// @dev    this function track the gauge index to emit the correct $SWPx amount after the distribution
    function _updateForAfterDistribution(address _gauge) private {
        address _pool = poolForGauge[_gauge];
        uint256 _time = _epochTimestamp() - Constants.EPOCH_LENGTH;
        uint256 _supplied = weightsPerEpoch[_time][_pool];

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

File 2 of 23 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init() internal onlyInitializing {
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal onlyInitializing {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 3 of 23 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

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

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

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

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

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

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

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

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

    /**
     * @dev Internal function that returns the initialized version. Returns `_initialized`
     */
    function _getInitializedVersion() internal view returns (uint8) {
        return _initialized;
    }

    /**
     * @dev Internal function that returns the initialized version. Returns `_initializing`
     */
    function _isInitializing() internal view returns (bool) {
        return _initializing;
    }
}

File 4 of 23 : ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

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

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

    uint256 private _status;

    function __ReentrancyGuard_init() internal onlyInitializing {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 5 of 23 : draft-IERC20PermitUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20PermitUpgradeable {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 6 of 23 : IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 7 of 23 : SafeERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20Upgradeable.sol";
import "../extensions/draft-IERC20PermitUpgradeable.sol";
import "../../../utils/AddressUpgradeable.sol";

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

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

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

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

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

    function safeDecreaseAllowance(
        IERC20Upgradeable token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    function safePermit(
        IERC20PermitUpgradeable token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

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

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

File 8 of 23 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

File 9 of 23 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;
import "../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;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

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

/**
 * @title The interface for the Algebra Factory
 * @dev Credit to Uniswap Labs under GPL-2.0-or-later license:
 * https://github.com/Uniswap/v3-core/tree/main/contracts/interfaces
 */
interface IAlgebraFactory {
  /**
   *  @notice Emitted when the owner of the factory is changed
   *  @param newOwner The owner after the owner was changed
   */
  event Owner(address indexed newOwner);

  /**
   *  @notice Emitted when the vault address is changed
   *  @param newVaultAddress The vault address after the address was changed
   */
  event VaultAddress(address indexed newVaultAddress);

  /**
   *  @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 pool The address of the created pool
   */
  event Pool(address indexed token0, address indexed token1, address pool);

  /**
   *  @notice Emitted when the farming address is changed
   *  @param newFarmingAddress The farming address after the address was changed
   */
  event FarmingAddress(address indexed newFarmingAddress);

  event FeeConfiguration(
    uint16 alpha1,
    uint16 alpha2,
    uint32 beta1,
    uint32 beta2,
    uint16 gamma1,
    uint16 gamma2,
    uint32 volumeBeta,
    uint16 volumeGamma,
    uint16 baseFee
  );

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

  /**
   *  @notice Returns the current poolDeployerAddress
   *  @return The address of the poolDeployer
   */
  function poolDeployer() external view returns (address);

  /**
   * @dev Is retrieved from the pools to restrict calling
   * certain functions not by a tokenomics contract
   * @return The tokenomics contract address
   */
  function farmingAddress() external view returns (address);

  function vaultAddress() external view returns (address);

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

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

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

  /**
   * @dev updates tokenomics address on the factory
   * @param _farmingAddress The new tokenomics contract address
   */
  function setFarmingAddress(address _farmingAddress) external;

  /**
   * @dev updates vault address on the factory
   * @param _vaultAddress The new vault contract address
   */
  function setVaultAddress(address _vaultAddress) external;

  /**
   * @notice Changes initial fee configuration for new pools
   * @dev changes coefficients for sigmoids: α / (1 + e^( (β-x) / γ))
   * alpha1 + alpha2 + baseFee (max possible fee) must be <= type(uint16).max
   * gammas must be > 0
   * @param alpha1 max value of the first sigmoid
   * @param alpha2 max value of the second sigmoid
   * @param beta1 shift along the x-axis for the first sigmoid
   * @param beta2 shift along the x-axis for the second sigmoid
   * @param gamma1 horizontal stretch factor for the first sigmoid
   * @param gamma2 horizontal stretch factor for the second sigmoid
   * @param volumeBeta shift along the x-axis for the outer volume-sigmoid
   * @param volumeGamma horizontal stretch factor the outer volume-sigmoid
   * @param baseFee minimum possible fee
   */
  function setBaseFeeConfiguration(
    uint16 alpha1,
    uint16 alpha2,
    uint32 beta1,
    uint32 beta2,
    uint16 gamma1,
    uint16 gamma2,
    uint32 volumeBeta,
    uint16 volumeGamma,
    uint16 baseFee
  ) external;
}

File 11 of 23 : IBribe.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

interface IBribe {
    function _deposit(uint amount, uint tokenId) external;
    function _withdraw(uint amount, uint tokenId) external;
    function getRewardForOwner(uint tokenId, address[] memory tokens) external;
    function getRewardForAddress(address _owner, address[] memory tokens) external;
    function notifyRewardAmount(address token, uint amount) external;
    function left(address token) external view returns (uint);
}

File 12 of 23 : IBribeFactory.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

interface IBribeFactory {
    function createInternalBribe(address[] memory) external returns (address);
    function createExternalBribe(address[] memory) external returns (address);
    function createBribe(address _owner,address _token0,address _token1, string memory _type) external returns (address);
}

File 13 of 23 : IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

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

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

File 14 of 23 : IGauge.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

interface IGauge {
    function notifyRewardAmount(address token, uint amount) external;
    function getReward(address account, address[] memory tokens) external;
    function getReward(address account) external;
    function claimFees() external returns (uint claimed0, uint claimed1);
    function left(address token) external view returns (uint);
    function rewardRate(address _pair) external view returns (uint);
    function balanceOf(address _account) external view returns (uint);
    function isForPair() external view returns (bool);
    function totalSupply() external view returns (uint);
    function earned(address token, address account) external view returns (uint);
    
}

File 15 of 23 : IGaugeFactory.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

interface IGaugeFactory {
    function createGauge(address, address, address, address, bool, address[] memory) external returns (address);
    function createGaugeV2(address _rewardToken,address _ve,address _token,address _distribution, address _internal_bribe, address _external_bribe, bool _isPair) external returns (address) ;
}

File 16 of 23 : IMasterchef.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.13;


interface IMasterchef {
    struct PoolInfo {
        uint256 accRewardPerShare;
        uint256 accRewardPerShareExtra;
        uint256 lastRewardTime;
    }

    function setDistributionRate(uint256 amount) external;

    function setDistributionRateExtra(uint256 amount) external;

    function updatePool() external returns (PoolInfo memory pool);
}

File 17 of 23 : IMinter.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

interface IMinter {
    function update_period() external returns (uint);
    function check() external view returns(bool);
    function period() external view returns(uint);
    function active_period() external view returns(uint);
}

File 18 of 23 : IPairFactory.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

interface IPairFactory {
    function allPairsLength() external view returns (uint);
    function isPair(address pair) external view returns (bool);
    function allPairs(uint index) external view returns (address);
    function stakingFeeHandler() external view returns (address);
    function dibs() external view returns (address);
    function MAX_TREASURY_FEE() external view returns (uint256);
    function stakingNFTFee() external view returns (uint256);
    function isPaused() external view returns (bool);
    function pairCodeHash() external pure returns (bytes32);
    function getPair(address tokenA, address token, bool stable) external view returns (address);
    function createPair(address tokenA, address tokenB, bool stable) external returns (address pair);
    function getInitializable() external view returns (address, address, bool);
    function getFee(bool _stable) external view returns(uint256);
}

File 19 of 23 : IPairInfo.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

interface IPairInfo {

    function token0() external view returns(address);
    function reserve0() external view returns(uint);
    function decimals0() external view returns(uint);
    function token1() external view returns(address);
    function reserve1() external view returns(uint);
    function decimals1() external view returns(uint);
    function isPair(address _pair) external view returns(bool);
}

File 20 of 23 : IPermissionsRegistry.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

interface IPermissionsRegistry {
    function emergencyCouncil() external view returns(address);
    function swpxTeamMultisig() external view returns(address);
    function hasRole(bytes memory role, address caller) external view returns(bool);
}

File 21 of 23 : IVotingEscrow.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

interface IVotingEscrow {

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

    struct LockedBalance {
        int128 amount;
        uint start;
        uint end;
    }

    function create_lock_for(uint _value, uint _lock_duration, address _to) external returns (uint);

    function locked(uint id) external view returns(LockedBalance memory);
    function tokenOfOwnerByIndex(address _owner, uint _tokenIndex) external view returns (uint);

    function token() external view returns (address);
    function team() external returns (address);
    function epoch() external view returns (uint);
    function point_history(uint loc) external view returns (Point memory);
    function user_point_history(uint tokenId, uint loc) external view returns (Point memory);
    function user_point_epoch(uint tokenId) external view returns (uint);

    function ownerOf(uint) external view returns (address);
    function isApprovedOrOwner(address, uint) external view returns (bool);
    function transferFrom(address, address, uint) external;

    function voted(uint) external view returns (bool);
    function attachments(uint) external view returns (uint);
    function voting(uint tokenId) external;
    function abstain(uint tokenId) external;
    function attach(uint tokenId) external;
    function detach(uint tokenId) external;

    function checkpoint() external;
    function deposit_for(uint tokenId, uint value) external;

    function balanceOfAtNFT(uint _tokenId, uint _block) external view returns (uint);
    function balanceOfNFT(uint _id) external view returns (uint);
    function balanceOf(address _owner) external view returns (uint);
    function totalSupply() external view returns (uint);
    function supply() external view returns (uint);


    function decimals() external view returns(uint8);
}

File 22 of 23 : Constants.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

library Constants {
    uint256 internal constant EPOCH_LENGTH = 30 minutes; //7 days;
}

File 23 of 23 : Math.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

library Math {
    function max(uint a, uint b) internal pure returns (uint) {
        return a >= b ? a : b;
    }
    function min(uint a, uint b) internal pure returns (uint) {
        return a < b ? a : b;
    }
    function sqrt(uint y) internal pure returns (uint z) {
        if (y > 3) {
            z = y;
            uint x = y / 2 + 1;
            while (x < z) {
                z = x;
                x = (y / x + x) / 2;
            }
        } else if (y != 0) {
            z = 1;
        }
    }
    function cbrt(uint256 n) internal pure returns (uint256) { unchecked {
        uint256 x = 0;
        for (uint256 y = 1 << 255; y > 0; y >>= 3) {
            x <<= 1;
            uint256 z = 3 * x * (x + 1) + 1;
            if (n / y >= z) {
                n -= y * z;
                x += 1;
            }
        }
        return x;
    }}
}

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

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Abstained","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pairfactory","type":"address"},{"indexed":true,"internalType":"address","name":"gaugefactory","type":"address"}],"name":"AddFactories","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"gauge","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"DistributeReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"gauge","type":"address"},{"indexed":false,"internalType":"address","name":"creator","type":"address"},{"indexed":false,"internalType":"address","name":"internal_bribe","type":"address"},{"indexed":true,"internalType":"address","name":"external_bribe","type":"address"},{"indexed":true,"internalType":"address","name":"pool","type":"address"}],"name":"GaugeCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"gauge","type":"address"}],"name":"GaugeKilled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"gauge","type":"address"}],"name":"GaugeRevived","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"reward","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"NotifyReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"old","type":"address"},{"indexed":true,"internalType":"address","name":"latest","type":"address"}],"name":"SetBribeFactory","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"isInternal","type":"bool"},{"indexed":true,"internalType":"address","name":"old","type":"address"},{"indexed":true,"internalType":"address","name":"latest","type":"address"},{"indexed":true,"internalType":"address","name":"gauge","type":"address"}],"name":"SetBribeFor","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"old","type":"address"},{"indexed":true,"internalType":"address","name":"latest","type":"address"}],"name":"SetGaugeFactory","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"old","type":"address"},{"indexed":true,"internalType":"address","name":"latest","type":"address"}],"name":"SetMinter","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"old","type":"address"},{"indexed":true,"internalType":"address","name":"latest","type":"address"}],"name":"SetPairFactory","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"old","type":"address"},{"indexed":true,"internalType":"address","name":"latest","type":"address"}],"name":"SetPermissionRegistry","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"old","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"latest","type":"uint256"}],"name":"SetVoteDelay","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"voter","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"weight","type":"uint256"},{"indexed":false,"internalType":"address","name":"pool","type":"address"}],"name":"Voted","type":"event"},{"inputs":[],"name":"MAX_VOTE_DELAY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VOTE_DELAY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_epochTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_permissionsRegistry","type":"address"},{"internalType":"address","name":"_minter","type":"address"}],"name":"_init","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"_ve","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_pairFactory","type":"address"},{"internalType":"address","name":"_gaugeFactory","type":"address"}],"name":"addFactory","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"bribefactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_bribes","type":"address[]"},{"internalType":"address[][]","name":"_tokens","type":"address[][]"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"claimBribes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_bribes","type":"address[]"},{"internalType":"address[][]","name":"_tokens","type":"address[][]"}],"name":"claimBribes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_fees","type":"address[]"},{"internalType":"address[][]","name":"_tokens","type":"address[][]"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"claimFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_bribes","type":"address[]"},{"internalType":"address[][]","name":"_tokens","type":"address[][]"}],"name":"claimFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_gauges","type":"address[]"}],"name":"claimRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"claimable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_pool","type":"address"},{"internalType":"uint256","name":"_gaugeType","type":"uint256"}],"name":"createGauge","outputs":[{"internalType":"address","name":"_gauge","type":"address"},{"internalType":"address","name":"_internal_bribe","type":"address"},{"internalType":"address","name":"_external_bribe","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_pool","type":"address[]"},{"internalType":"uint256[]","name":"_gaugeTypes","type":"uint256[]"}],"name":"createGauges","outputs":[{"internalType":"address[]","name":"","type":"address[]"},{"internalType":"address[]","name":"","type":"address[]"},{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_gauges","type":"address[]"}],"name":"distribute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"finish","type":"uint256"}],"name":"distribute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"distributeAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_gauges","type":"address[]"}],"name":"distributeFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"external_bribes","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factories","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factoryLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gaugeFactories","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gaugeFactoriesLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"gauges","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"gaugesDistributionTimestmap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"hasGaugeKilled","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_time","type":"uint256"}],"name":"indexAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"__ve","type":"address"},{"internalType":"address","name":"_pairFactory","type":"address"},{"internalType":"address","name":"_gaugeFactory","type":"address"},{"internalType":"address","name":"_bribes","type":"address"},{"internalType":"address","name":"_masterChef","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"internal_bribes","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isAlive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isFactory","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isGauge","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isGaugeFactory","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"}],"name":"killGauge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"lastVoted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"length","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"masterChef","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"notifyRewardAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"permissionRegistry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"poke","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"poolForGauge","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolVote","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"poolVoteLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"pools","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"recoverERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pos","type":"uint256"}],"name":"removeFactory","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_pairFactory","type":"address"},{"internalType":"address","name":"_gaugeFactory","type":"address"},{"internalType":"uint256","name":"_pos","type":"uint256"}],"name":"replaceFactory","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"reset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"}],"name":"reviveGauge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_bribeFactory","type":"address"}],"name":"setBribeFactory","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"},{"internalType":"address","name":"_external","type":"address"}],"name":"setExternalBribeFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"},{"internalType":"address","name":"_internal","type":"address"}],"name":"setInternalBribeFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_minter","type":"address"}],"name":"setMinter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"},{"internalType":"address","name":"_internal","type":"address"},{"internalType":"address","name":"_external","type":"address"}],"name":"setNewBribes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_factory","type":"address"}],"name":"setPairFactory","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_permissionRegistry","type":"address"}],"name":"setPermissionsRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_delay","type":"uint256"}],"name":"setVoteDelay","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalWeight","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_time","type":"uint256"}],"name":"totalWeightAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address[]","name":"_poolVote","type":"address[]"},{"internalType":"uint256[]","name":"_weights","type":"uint256[]"}],"name":"vote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"votes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_pool","type":"address"}],"name":"weights","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_pool","type":"address"},{"internalType":"uint256","name":"_time","type":"uint256"}],"name":"weightsAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

60c0604052610708608081905260a05234801561001b57600080fd5b5060805160a051615e9062000046600039600081816105be015261266e015260005050615e906000f3fe608060405234801561001057600080fd5b50600436106103175760003560e01c806306d6a1b21461031c578063075461721461035b5780630f04ba671461036e5780631459457a146103a15780631703e5f9146103b65780631f7b6d32146103d957806327e5c823146103eb578063310bd74b146103fe57806332145f901461041157806333832a6a1461042457806334b896f21461043757806338752a9d1461044a5780633c6b16ab1461045d578063402914f514610470578063436596c414610490578063470f4985146104985780634d68ce44146104a057806353be568d146104c2578063575a86b2146104e2578063577387b5146104f55780636138889b14610508578063636056f21461051b5780636447e7da146105505780636566afad14610570578063657021fb14610583578063666256aa146105a65780636c4f2e38146105b9578063715018a6146105e05780637625391a146105e85780637715ee75146105fb5780637964bac91461060e5780637ac09bf7146106215780638980f11f146106345780638b6fc247146106475780638da5cb5b1461065a5780638dd598fb1461066257806390e934161461067557806396c82e571461068a578063992a7933146106925780639f06247b146106a5578063a42bbccd146106b8578063a7cac846146106d8578063a86a366d146106eb578063a9b5aa7e146106fe578063aa79979b14610711578063ac4afa3814610734578063ae21c4cb14610747578063b0f5027814610770578063b52a315114610783578063b55a5c1c1461078b578063b7c89f9c1461079e578063b9a09fd5146107b1578063c2b79e98146107da578063c445d88a146107ed578063c45a01551461080d578063c527ee1f14610820578063c991866d14610833578063d23254b414610846578063daa168bd14610871578063dcd9e47a14610884578063eae40f26146108c1578063f2fde38b146108ea578063f3594be0146108fd578063f3c9c3861461091d578063f8803bb61461093d578063f9f031df14610945578063fca3b5aa14610958578063fe5b38e41461096b578063ffe5195b14610973575b600080fd5b61034561032a3660046151aa565b60a9602052600090815260409020546001600160a01b031681565b60405161035291906151ce565b60405180910390f35b609e54610345906001600160a01b031681565b61039161037c3660046151aa565b60b36020526000908152604090205460ff1681565b6040519015158152602001610352565b6103b46103af3660046151e2565b61097c565b005b6103916103c43660046151aa565b60b26020526000908152604090205460ff1681565b60a0545b604051908152602001610352565b6103b46103f9366004615253565b610bf8565b6103b461040c366004615294565b610ecf565b6103b461041f366004615294565b611005565b6103b46104323660046151aa565b61121d565b6103b46104453660046152ad565b611356565b609d54610345906001600160a01b031681565b6103b461046b366004615294565b611430565b6103dd61047e3660046151aa565b60a66020526000908152604090205481565b6103b4611556565b609a546103dd565b6104b36104ae3660046153c3565b6116cb565b604051610352939291906154c1565b6103dd6104d0366004615294565b600090815260af602052604090205490565b60a154610345906001600160a01b031681565b6103b4610503366004615294565b611901565b6103b4610516366004615504565b611b72565b6103dd610529366004615538565b600090815260ae602090815260408083206001600160a01b03949094168352929052205490565b6103dd61055e366004615294565b600090815260ad602052604090205490565b6103b461057e3660046152ad565b611cb9565b6103916105913660046151aa565b60b46020526000908152604090205460ff1681565b6103b46105b43660046155e3565b611eee565b6103dd7f000000000000000000000000000000000000000000000000000000000000000081565b6103b4612034565b6103b46105f636600461564f565b612046565b6103b46106093660046155e3565b612187565b6103b461061c3660046151aa565b6122c7565b6103b461062f3660046156bc565b612376565b6103b4610642366004615538565b6124ff565b6103b4610655366004615294565b6125a0565b610345612708565b609854610345906001600160a01b031681565b61067d612717565b6040516103529190615735565b6103dd612779565b6103b46106a03660046151aa565b612799565b6103b46106b33660046151aa565b61292b565b6103dd6106c6366004615294565b600090815260a4602052604090205490565b6103dd6106e63660046151aa565b612af0565b6103456106f936600461564f565b612b27565b6103b461070c3660046151aa565b612b5f565b61039161071f3660046151aa565b60b16020526000908152604090205460ff1681565b610345610742366004615294565b612c98565b6103456107553660046151aa565b60ab602052600090815260409020546001600160a01b031681565b6103b461077e366004615748565b612cc2565b609c546103dd565b609f54610345906001600160a01b031681565b6103b46107ac3660046152ad565b612dca565b6103456107bf3660046151aa565b60a7602052600090815260409020546001600160a01b031681565b6103b46107e8366004615793565b612e99565b6103dd6107fb3660046151aa565b60a86020526000908152604090205481565b609954610345906001600160a01b031681565b6103b461082e366004615504565b612f4a565b6103b4610841366004615793565b61306e565b6103dd6108543660046157f6565b60ac60209081526000928352604080842090915290825290205481565b6103b461087f3660046152ad565b61311f565b610897610892366004615538565b6131ee565b604080516001600160a01b0394851681529284166020840152921691810191909152606001610352565b6103456108cf3660046151aa565b60aa602052600090815260409020546001600160a01b031681565b6103b46108f83660046151aa565b613216565b6103dd61090b366004615294565b60b06020526000908152604090205481565b6103dd61092b3660046151aa565b60b56020526000908152604090205481565b6103dd61328c565b6103b4610953366004615504565b613352565b6103b46109663660046151aa565b6133e8565b61067d613521565b6103dd60a35481565b600054610100900460ff161580801561099c5750600054600160ff909116105b806109bd57506109ab30613581565b1580156109bd575060005460ff166001145b610a255760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff191660011790558015610a48576000805461ff0019166101001790555b610a50613590565b610a586135bf565b609880546001600160a01b0319166001600160a01b03881690811790915560408051637e062a3560e11b8152905163fc0c546a916004808201926020929091908290030181865afa158015610ab1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ad5919061581b565b609b80546001600160a01b03199081166001600160a01b0393841617909155609a80546001818101909255600080516020615dbb8339815191520180548316898516908117909155600090815260b360209081526040808320805460ff199081168617909155609c8054808701909155600080516020615e1b83398151915201805487168c8916908117909155845260b490925290912080549091169091179055609d80548216868416179055609e8054339083168117909155609f80548316909117905560a180549091169184169190911790558015610bf0576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050565b609f54604051634448e1eb60e01b81526001600160a01b0390911690634448e1eb90610c28903390600401615856565b602060405180830381865afa158015610c45573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c699190615882565b610c855760405162461bcd60e51b8152600401610a1c906158a4565b6001600160a01b038316610cab5760405162461bcd60e51b8152600401610a1c906158bc565b6001600160a01b038216610cd15760405162461bcd60e51b8152600401610a1c906158bc565b6001600160a01b038316600090815260b3602052604090205460ff1615610d0a5760405162461bcd60e51b8152600401610a1c906158db565b6001600160a01b038216600090815260b4602052604090205460ff1615610d435760405162461bcd60e51b8152600401610a1c906158f9565b6000609a8281548110610d5857610d58615918565b6000918252602082200154609c80546001600160a01b0390921693509084908110610d8557610d85615918565b60009182526020808320909101546001600160a01b03858116845260b383526040808520805460ff199081169091559190921680855260b490935292208054909216909155609a8054919250869185908110610de357610de3615918565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555083609c8481548110610e2557610e25615918565b600091825260208083209190910180546001600160a01b0319166001600160a01b03948516179055878316825260b381526040808320805460ff19908116600190811790925589861680865260b490945282852080549091169091179055519092841691600080516020615ddb83398151915291a3846001600160a01b0316826001600160a01b0316600080516020615dfb83398151915260405160405180910390a35050505050565b610ed76135ee565b610ee081613647565b60985460405163430c208160e01b81526001600160a01b039091169063430c208190610f12903390859060040161592e565b602060405180830381865afa158015610f2f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f539190615882565b610f6f5760405162461bcd60e51b8152600401610a1c90615947565b610f78816136a3565b60985460405163c1f0fb9f60e01b8152600481018390526001600160a01b039091169063c1f0fb9f90602401600060405180830381600087803b158015610fbe57600080fd5b505af1158015610fd2573d6000803e3d6000fd5b50505050610fde61328c565b610fe9906001615986565b600082815260b060205260409020556110026001606555565b50565b61100d6135ee565b61101681613647565b60985460405163430c208160e01b81526001600160a01b039091169063430c208190611048903390859060040161592e565b602060405180830381865afa158015611065573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110899190615882565b6110a55760405162461bcd60e51b8152600401610a1c90615947565b600081815260ad602090815260408083208054825181850281018501909352808352919290919083018282801561110557602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116110e7575b505050505090506000815190506000816001600160401b0381111561112c5761112c6152e6565b604051908082528060200260200182016040528015611155578160200160208202803683370190505b50905060005b828110156111e25760ac6000868152602001908152602001600020600085838151811061118a5761118a615918565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020548282815181106111c5576111c5615918565b6020908102919091010152806111da8161599e565b91505061115b565b506111ee848483613a7b565b6111f661328c565b611201906001615986565b600085815260b06020526040902055506110029150613a749050565b609f54604051634448e1eb60e01b81526001600160a01b0390911690634448e1eb9061124d903390600401615856565b602060405180830381865afa15801561126a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061128e9190615882565b6112aa5760405162461bcd60e51b8152600401610a1c906158a4565b6000816001600160a01b03163b116112d45760405162461bcd60e51b8152600401610a1c906159b7565b6001600160a01b0381166112fa5760405162461bcd60e51b8152600401610a1c906158bc565b609f546040516001600160a01b038084169216907f19fff1a4baaea69caec27e064bdfc0cb61d642370694fffdc0d38a568eb89b7390600090a3609f80546001600160a01b0319166001600160a01b0392909216919091179055565b609e546001600160a01b03163314806113db5750609f54604051634448e1eb60e01b81526001600160a01b0390911690634448e1eb9061139a903390600401615856565b602060405180830381865afa1580156113b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113db9190615882565b6113e457600080fd5b609754156113f157600080fd5b609e80546001600160a01b038084166001600160a01b031992831617909255609f80549285169290911691909117905561142961328c565b6097555050565b609e546001600160a01b031633146114745760405162461bcd60e51b815260206004820152600760248201526610b6b4b73a32b960c91b6044820152606401610a1c565b600061070861148161328c565b61148b91906159da565b600081815260af602052604081205491925081156114db57609b546114bb906001600160a01b0316333087613f75565b816114ce85670de0b6b3a76400006159f1565b6114d89190615a10565b90505b801561150b578060a260008282546114f39190615986565b909155505060a254600084815260a460205260409020555b609b546040518581526001600160a01b039091169033907ff70d5c697de7ea828df48e5c4573cb2194c659f1901f70110c52b066dcf50826906020015b60405180910390a350505050565b61155e6135ee565b609e60009054906101000a90046001600160a01b03166001600160a01b031663ed29fc116040518163ffffffff1660e01b81526004016020604051808303816000875af11580156115b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115d79190615a32565b5060a160009054906101000a90046001600160a01b03166001600160a01b031663e3161ddd6040518163ffffffff1660e01b81526004016060604051808303816000875af115801561162d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116519190615a4b565b5060a0546000905b808210156116bd576116ab60a7600060a0858154811061167b5761167b615918565b60009182526020808320909101546001600160a01b03908116845290830193909352604090910190205416613fe0565b816116b58161599e565b925050611659565b50506116c96001606555565b565b60608060606116d86135ee565b83518551146117185760405162461bcd60e51b815260206004820152600c60248201526b0d8cadc40dad2e6dac2e8c6d60a31b6044820152606401610a1c565b600a855111156117535760405162461bcd60e51b815260206004820152600660248201526506d61782031360d41b6044820152606401610a1c565b600085516001600160401b0381111561176e5761176e6152e6565b604051908082528060200260200182016040528015611797578160200160208202803683370190505b509050600086516001600160401b038111156117b5576117b56152e6565b6040519080825280602002602001820160405280156117de578160200160208202803683370190505b509050600087516001600160401b038111156117fc576117fc6152e6565b604051908082528060200260200182016040528015611825578160200160208202803683370190505b50905060005b88518110156118e85761187089828151811061184957611849615918565b602002602001015189838151811061186357611863615918565b602002602001015161411d565b86848151811061188257611882615918565b6020026020010186858151811061189b5761189b615918565b602002602001018686815181106118b4576118b4615918565b6001600160a01b039485166020918202929092010152928216909252919091169052806118e08161599e565b91505061182b565b50919450925090506118fa6001606555565b9250925092565b609f54604051634448e1eb60e01b81526001600160a01b0390911690634448e1eb90611931903390600401615856565b602060405180830381865afa15801561194e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119729190615882565b61198e5760405162461bcd60e51b8152600401610a1c906158a4565b6000609a82815481106119a3576119a3615918565b6000918252602082200154609c80546001600160a01b03909216935090849081106119d0576119d0615918565b60009182526020808320909101546001600160a01b03858116845260b39092526040909220549116915060ff16611a315760405162461bcd60e51b815260206004820152600560248201526408599858dd60da1b6044820152606401610a1c565b6001600160a01b038116600090815260b4602052604090205460ff16611a825760405162461bcd60e51b81526020600482015260066024820152650859d19858dd60d21b6044820152606401610a1c565b6000609a8481548110611a9757611a97615918565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506000609c8481548110611ada57611ada615918565b600091825260208083209190910180546001600160a01b0319166001600160a01b03948516179055848316825260b381526040808320805460ff1990811690915593851680845260b490925280832080549094169093559151909190600080516020615ddb833981519152908390a36040516000906001600160a01b03841690600080516020615dfb833981519152908390a3505050565b611b7a6135ee565b609e60009054906101000a90046001600160a01b03166001600160a01b031663ed29fc116040518163ffffffff1660e01b81526004016020604051808303816000875af1158015611bcf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bf39190615a32565b5060a160009054906101000a90046001600160a01b03166001600160a01b031663e3161ddd6040518163ffffffff1660e01b81526004016060604051808303816000875af1158015611c49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c6d9190615a4b565b5060005b8151811015611cae57611c9c828281518110611c8f57611c8f615918565b6020026020010151613fe0565b80611ca68161599e565b915050611c71565b506110026001606555565b609f54604051634448e1eb60e01b81526001600160a01b0390911690634448e1eb90611ce9903390600401615856565b602060405180830381865afa158015611d06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d2a9190615882565b611d465760405162461bcd60e51b8152600401610a1c906158a4565b6001600160a01b038216611d6c5760405162461bcd60e51b8152600401610a1c906158bc565b6001600160a01b038116611d925760405162461bcd60e51b8152600401610a1c906158bc565b6001600160a01b038216600090815260b3602052604090205460ff1615611dcb5760405162461bcd60e51b8152600401610a1c906158db565b6001600160a01b038116600090815260b4602052604090205460ff1615611e045760405162461bcd60e51b8152600401610a1c906158f9565b6000816001600160a01b03163b11611e2e5760405162461bcd60e51b8152600401610a1c906159b7565b609a80546001818101909255600080516020615dbb8339815191520180546001600160a01b038086166001600160a01b03199283168117909355609c8054808601909155600080516020615e1b833981519152018054918616919092168117909155600082815260b360209081526040808320805460ff19908116881790915584845260b490925280832080549092169095179055925190927f8bad2b894999c82738dc185dbb158d846fce35d7edbcc0661b1b97d9aacba69d91a35050565b60985460405163430c208160e01b81526001600160a01b039091169063430c208190611f20903390859060040161592e565b602060405180830381865afa158015611f3d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f619190615882565b611f7d5760405162461bcd60e51b8152600401610a1c90615947565b60005b835181101561202e57838181518110611f9b57611f9b615918565b60200260200101516001600160a01b031663a7852afa83858481518110611fc457611fc4615918565b60200260200101516040518363ffffffff1660e01b8152600401611fe9929190615aa6565b600060405180830381600087803b15801561200357600080fd5b505af1158015612017573d6000803e3d6000fd5b5050505080806120269061599e565b915050611f80565b50505050565b61203c614b73565b6116c96000614bd2565b61204e6135ee565b609e60009054906101000a90046001600160a01b03166001600160a01b031663ed29fc116040518163ffffffff1660e01b81526004016020604051808303816000875af11580156120a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120c79190615a32565b5060a160009054906101000a90046001600160a01b03166001600160a01b031663e3161ddd6040518163ffffffff1660e01b81526004016060604051808303816000875af115801561211d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121419190615a4b565b50815b818110156121785761216660a7600060a0848154811061167b5761167b615918565b806121708161599e565b915050612144565b506121836001606555565b5050565b60985460405163430c208160e01b81526001600160a01b039091169063430c2081906121b9903390859060040161592e565b602060405180830381865afa1580156121d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121fa9190615882565b6122165760405162461bcd60e51b8152600401610a1c90615947565b60005b835181101561202e5783818151811061223457612234615918565b60200260200101516001600160a01b031663a7852afa8385848151811061225d5761225d615918565b60200260200101516040518363ffffffff1660e01b8152600401612282929190615aa6565b600060405180830381600087803b15801561229c57600080fd5b505af11580156122b0573d6000803e3d6000fd5b5050505080806122bf9061599e565b915050612219565b609f54604051634448e1eb60e01b81526001600160a01b0390911690634448e1eb906122f7903390600401615856565b602060405180830381865afa158015612314573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123389190615882565b6123545760405162461bcd60e51b8152600401610a1c906158a4565b609980546001600160a01b0319166001600160a01b0392909216919091179055565b61237e6135ee565b61238785613647565b60985460405163430c208160e01b81526001600160a01b039091169063430c2081906123b9903390899060040161592e565b602060405180830381865afa1580156123d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123fa9190615882565b6124165760405162461bcd60e51b8152600401610a1c90615947565b82811461245e5760405162461bcd60e51b8152602060048201526016602482015275506f6f6c2f57656967687473206c656e67746820213d60501b6044820152606401610a1c565b6124cc8585858080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020808902828101820190935288825290935088925087918291850190849080828437600092019190915250613a7b92505050565b6124d461328c565b6124df906001615986565b600086815260b060205260409020556124f86001606555565b5050505050565b609f54604051634448e1eb60e01b81526001600160a01b0390911690634448e1eb9061252f903390600401615856565b602060405180830381865afa15801561254c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125709190615882565b61258c5760405162461bcd60e51b8152600401610a1c906158a4565b6121836001600160a01b0383163383614c24565b609f54604051634448e1eb60e01b81526001600160a01b0390911690634448e1eb906125d0903390600401615856565b602060405180830381865afa1580156125ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126119190615882565b61262d5760405162461bcd60e51b8152600401610a1c906158a4565b60a354810361266c5760405162461bcd60e51b815260206004820152600b60248201526a185b1c9958591e481cd95d60aa1b6044820152606401610a1c565b7f00000000000000000000000000000000000000000000000000000000000000008111156126c85760405162461bcd60e51b81526020600482015260096024820152686d61782064656c617960b81b6044820152606401610a1c565b7f17fb843f25faf2431510bc4a71e4898ccc1a28a3e985450e509670d14be2eaa160a354826040516126fb929190615abf565b60405180910390a160a355565b6033546001600160a01b031690565b6060609c80548060200260200160405190810160405280929190818152602001828054801561276f57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612751575b5050505050905090565b60008061278461328c565b600090815260af602052604090205492915050565b609f54604051634448e1eb60e01b81526001600160a01b0390911690634448e1eb906127c9903390600401615aea565b602060405180830381865afa1580156127e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061280a9190615882565b6128265760405162461bcd60e51b8152600401610a1c90615afc565b6001600160a01b038116600090815260b2602052604090205460ff1661285e5760405162461bcd60e51b8152600401610a1c90615b0e565b6001600160a01b038116600090815260b260209081526040808320805460ff1916905560a6909152812081905561289361328c565b600081815260ae602090815260408083206001600160a01b03808816855260a984528285205416845282528083205484845260af9092528220805493945090929091906128e19084906159da565b90915550506001600160a01b038216600081815260b56020526040808220849055517f04a5d3f5d80d22d9345acc80618f4a4e7e663cf9e1aed23b57d975acec002ba79190a25050565b609f54604051634448e1eb60e01b81526001600160a01b0390911690634448e1eb9061295b903390600401615aea565b602060405180830381865afa158015612978573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061299c9190615882565b6129b85760405162461bcd60e51b8152600401610a1c90615afc565b6001600160a01b038116600090815260b2602052604090205460ff1615612a095760405162461bcd60e51b8152602060048201526005602482015264616c69766560d81b6044820152606401610a1c565b6001600160a01b038116600090815260b1602052604090205460ff16612a415760405162461bcd60e51b8152600401610a1c90615b0e565b6001600160a01b038116600090815260b56020526040902054612a6261328c565b11612a975760405162461bcd60e51b81526020600482015260056024820152646561726c7960d81b6044820152606401610a1c565b6001600160a01b038116600081815260b260209081526040808320805460ff1916600117905560b5909152808220829055517fed18e9faa3dccfd8aa45f69c4de40546b2ca9cccc4538a2323531656516db1aa9190a250565b600080612afb61328c565b600090815260ae602090815260408083206001600160a01b039096168352949052929092205492915050565b60ad6020528160005260406000208181548110612b4357600080fd5b6000918252602090912001546001600160a01b03169150829050565b609f54604051634448e1eb60e01b81526001600160a01b0390911690634448e1eb90612b8f903390600401615856565b602060405180830381865afa158015612bac573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bd09190615882565b612bec5760405162461bcd60e51b8152600401610a1c906158a4565b6000816001600160a01b03163b11612c165760405162461bcd60e51b8152600401610a1c906159b7565b6001600160a01b038116612c3c5760405162461bcd60e51b8152600401610a1c906158bc565b609d546040516001600160a01b038084169216907f03ab94e51ce1ec8483c05c7425f6ebc27289fbd4a9c8b6ba0c2fe3b8b01765d490600090a3609d80546001600160a01b0319166001600160a01b0392909216919091179055565b60a08181548110612ca857600080fd5b6000918252602090912001546001600160a01b0316905081565b609f54604051634448e1eb60e01b81526001600160a01b0390911690634448e1eb90612cf2903390600401615856565b602060405180830381865afa158015612d0f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d339190615882565b612d4f5760405162461bcd60e51b8152600401610a1c906158a4565b6001600160a01b038316600090815260b1602052604090205460ff16612d875760405162461bcd60e51b8152600401610a1c90615b2e565b6000836001600160a01b03163b11612db15760405162461bcd60e51b8152600401610a1c906159b7565b612dbb8383614c43565b612dc58382614ce1565b505050565b609f54604051634448e1eb60e01b81526001600160a01b0390911690634448e1eb90612dfa903390600401615856565b602060405180830381865afa158015612e17573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e3b9190615882565b612e575760405162461bcd60e51b8152600401610a1c906158a4565b6001600160a01b038216600090815260b1602052604090205460ff16612e8f5760405162461bcd60e51b8152600401610a1c90615b2e565b6121838282614c43565b60005b8251811015612dc557828181518110612eb757612eb7615918565b60200260200101516001600160a01b031663db0ea98433848481518110612ee057612ee0615918565b60200260200101516040518363ffffffff1660e01b8152600401612f05929190615b4e565b600060405180830381600087803b158015612f1f57600080fd5b505af1158015612f33573d6000803e3d6000fd5b505050508080612f429061599e565b915050612e9c565b60005b81518110156121835760b16000838381518110612f6c57612f6c615918565b6020908102919091018101516001600160a01b031682528101919091526040016000205460ff168015612fd8575060b26000838381518110612fb057612fb0615918565b6020908102919091018101516001600160a01b031682528101919091526040016000205460ff165b1561305c57818181518110612fef57612fef615918565b60200260200101516001600160a01b031663d294f0936040518163ffffffff1660e01b815260040160408051808303816000875af1158015613035573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130599190615b72565b50505b806130668161599e565b915050612f4d565b60005b8251811015612dc55782818151811061308c5761308c615918565b60200260200101516001600160a01b031663db0ea984338484815181106130b5576130b5615918565b60200260200101516040518363ffffffff1660e01b81526004016130da929190615b4e565b600060405180830381600087803b1580156130f457600080fd5b505af1158015613108573d6000803e3d6000fd5b5050505080806131179061599e565b915050613071565b609f54604051634448e1eb60e01b81526001600160a01b0390911690634448e1eb9061314f903390600401615856565b602060405180830381865afa15801561316c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131909190615882565b6131ac5760405162461bcd60e51b8152600401610a1c906158a4565b6001600160a01b038216600090815260b1602052604090205460ff166131e45760405162461bcd60e51b8152600401610a1c90615b2e565b6121838282614ce1565b60008060006131fb6135ee565b613205858561411d565b919450925090506118fa6001606555565b61321e614b73565b6001600160a01b0381166132835760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a1c565b61100281614bd2565b600080609e60009054906101000a90046001600160a01b03166001600160a01b031663d13996086040518163ffffffff1660e01b8152600401602060405180830381865afa1580156132e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133069190615a32565b90508060000361334d5760405162461bcd60e51b81526020600482015260126024820152714e6f7420737461727465642065706f63687360701b6044820152606401610a1c565b919050565b60005b81518110156121835781818151811061337057613370615918565b60200260200101516001600160a01b031663c00007b0336040518263ffffffff1660e01b81526004016133a391906151ce565b600060405180830381600087803b1580156133bd57600080fd5b505af11580156133d1573d6000803e3d6000fd5b5050505080806133e09061599e565b915050613355565b609f54604051634448e1eb60e01b81526001600160a01b0390911690634448e1eb90613418903390600401615856565b602060405180830381865afa158015613435573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134599190615882565b6134755760405162461bcd60e51b8152600401610a1c906158a4565b6001600160a01b03811661349b5760405162461bcd60e51b8152600401610a1c906158bc565b6000816001600160a01b03163b116134c55760405162461bcd60e51b8152600401610a1c906159b7565b609e546040516001600160a01b038084169216907fe490d3138e32f1f66ef3971a3c73c7f7704ba0c1d1000f1e2c3df6fc0376610b90600090a3609e80546001600160a01b0319166001600160a01b0392909216919091179055565b6060609a80548060200260200160405190810160405280929190818152602001828054801561276f576020028201919060005260206000209081546001600160a01b03168152600190910190602001808311612751575050505050905090565b6001600160a01b03163b151590565b600054610100900460ff166135b75760405162461bcd60e51b8152600401610a1c90615b96565b6116c9614d7c565b600054610100900460ff166135e65760405162461bcd60e51b8152600401610a1c90615b96565b6116c9614dac565b6002606554036136405760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610a1c565b6002606555565b60a354600082815260b060205260409020546136639190615986565b42116110025760405162461bcd60e51b815260206004820152600f60248201526e4552523a20564f54455f44454c415960881b6044820152606401610a1c565b600081815260ad6020526040812080549091806136be61328c565b90506000836001600160401b038111156136da576136da6152e6565b604051908082528060200260200182016040528015613703578160200160208202803683370190505b5090506000805b858110156139e25786818154811061372457613724615918565b60009182526020808320909101548a835260ac825260408084206001600160a01b039092168085529190925291205484519193509084908390811061376b5761376b615918565b60200260200101818152505082818151811061378957613789615918565b60200260200101516000146139da57600088815260b060205260409020548410156137f6578281815181106137c0576137c0615918565b602090810291909101810151600086815260ae835260408082206001600160a01b03871683529093529190912080549190910390555b82818151811061380857613808615918565b60209081029190910181015160008a815260ac835260408082206001600160a01b038716835284528082208054939093039092558a815260b090925290205484101561398b576001600160a01b03808316600090815260a760209081526040808320548416835260aa9091529020548451911690639e2bf22c9085908490811061389457613894615918565b60200260200101518a6040518363ffffffff1660e01b81526004016138ba929190615abf565b600060405180830381600087803b1580156138d457600080fd5b505af11580156138e8573d6000803e3d6000fd5b5050506001600160a01b03808416600090815260a760209081526040808320548416835260ab909152902054855191169150639e2bf22c9085908490811061393257613932615918565b60200260200101518a6040518363ffffffff1660e01b8152600401613958929190615abf565b600060405180830381600087803b15801561397257600080fd5b505af1158015613986573d6000803e3d6000fd5b505050505b6001600160a01b03808316600090815260a76020908152604080832054909316825260b29052205460ff16156139da578281815181106139cd576139cd615918565b6020026020010151850194505b60010161370a565b50600087815260b060205260409020548311156139fe57600093505b600083815260af602052604081208054869290613a1c9084906159da565b9091555050600087815260ad60205260408120613a3891615163565b6040518781527fa7162958659bd0c96888ff99c33ec75cbfb9ae5087ba44fcae10a873305ef5249060200160405180910390a150505050505050565b6001606555565b613a84836136a3565b81516098546040516339f890b560e21b8152600481018690526000916001600160a01b03169063e7e242d490602401602060405180830381865afa158015613ad0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613af49190615a32565b9050600080600080613b0461328c565b905060005b86811015613ba85760b2600060a760008c8581518110613b2b57613b2b615918565b6020908102919091018101516001600160a01b0390811683528282019390935260409182016000908120549093168452830193909352910190205460ff1615613b9657878181518110613b8057613b80615918565b602002602001015185613b939190615986565b94505b80613ba08161599e565b915050613b09565b5060005b86811015613ee1576000898281518110613bc857613bc8615918565b6020908102919091018101516001600160a01b03808216600090815260a7845260408082205490921680825260b1909452205490925060ff168015613c2557506001600160a01b038116600090815260b2602052604090205460ff165b15613ecc57600087898c8681518110613c4057613c40615918565b6020026020010151613c5291906159f1565b613c5c9190615a10565b60008e815260ac602090815260408083206001600160a01b038816845290915290205490915015613c8c57600080fd5b80600003613c9957600080fd5b60008d815260ad6020908152604080832080546001810182559084528284200180546001600160a01b0319166001600160a01b03881690811790915588845260ae835281842090845290915281208054839290613cf7908490615986565b909155505060008d815260ac602090815260408083206001600160a01b038716845290915281208054839290613d2e908490615986565b9250508190555060aa6000836001600160a01b03166001600160a01b0316815260200190815260200160002060009054906101000a90046001600160a01b03166001600160a01b031663f3207723828f6040518363ffffffff1660e01b8152600401613d9b929190615abf565b600060405180830381600087803b158015613db557600080fd5b505af1158015613dc9573d6000803e3d6000fd5b5050505060ab6000836001600160a01b03166001600160a01b0316815260200190815260200160002060009054906101000a90046001600160a01b03166001600160a01b031663f3207723828f6040518363ffffffff1660e01b8152600401613e33929190615abf565b600060405180830381600087803b158015613e4d57600080fd5b505af1158015613e61573d6000803e3d6000fd5b505050508086613e719190615986565b9550613e7d8188615986565b604080518f8152602081018490526001600160a01b03861681830152905191985033917ffdaa0bde29644a3131ccc1c258e3b291894018a4fb5d46c8f494c80256e35ec59181900360600190a2505b50508080613ed99061599e565b915050613bac565b508115613f475760985460405163fd4a77f160e01b8152600481018b90526001600160a01b039091169063fd4a77f190602401600060405180830381600087803b158015613f2e57600080fd5b505af1158015613f42573d6000803e3d6000fd5b505050505b600081815260af602052604081208054859290613f65908490615986565b9091555050505050505050505050565b6040516001600160a01b038085166024830152831660448201526064810182905261202e9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614dd3565b6001600160a01b038116600090815260a860205260408120549061400261328c565b905080821015612dc55761401583614ea5565b6001600160a01b038316600090815260a66020526040902054801580159061405557506001600160a01b038416600090815260b2602052604090205460ff165b1561202e576001600160a01b03808516600081815260a66020908152604080832083905560a890915290819020859055609b54905163b66503cf60e01b8152919263b66503cf926140ae9290911690859060040161592e565b600060405180830381600087803b1580156140c857600080fd5b505af11580156140dc573d6000803e3d6000fd5b50506040518381526001600160a01b03871692503391507f4fa9693cae526341d334e2862ca2413b2e503f1266255f9e0869fb36e6d89b1790602001611548565b609f54604051634448e1eb60e01b8152600091829182916001600160a01b031690634448e1eb90614152903390600401615aea565b602060405180830381865afa15801561416f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906141939190615882565b61419c57600080fd5b609a5484106141d95760405162461bcd60e51b815260206004820152600960248201526867617567657479706560b81b6044820152606401610a1c565b6001600160a01b03858116600090815260a76020526040902054161561422b5760405162461bcd60e51b81526020600482015260076024820152662165786973747360c81b6044820152606401610a1c565b6000856001600160a01b03163b116142555760405162461bcd60e51b8152600401610a1c906159b7565b600080609a868154811061426b5761426b615918565b6000918252602082200154609c80546001600160a01b039092169350908890811061429857614298615918565b6000918252602090912001546001600160a01b03908116915082166142cf5760405162461bcd60e51b8152600401610a1c906158bc565b6001600160a01b0381166142f55760405162461bcd60e51b8152600401610a1c906158bc565b600080896001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015614336573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061435a919061581b565b9150896001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561439a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143be919061581b565b9050886000036144385760405163e5e31b1360e01b81526001600160a01b0385169063e5e31b13906143f4908d906004016151ce565b602060405180830381865afa158015614411573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906144359190615882565b94505b886001036145715760405163d9a641e160e01b81526000906001600160a01b0386169063d9a641e1906144719086908690600401615be1565b602060405180830381865afa15801561448e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906144b2919061581b565b905060008b6001600160a01b03166316f0115b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156144f4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614518919061581b565b9050816001600160a01b0316816001600160a01b03161461456a5760405162461bcd60e51b815260206004820152600c60248201526b77726f6e6720746f6b656e7360a01b6044820152606401610a1c565b6001965050505b609f5460408051636755d7b160e01b815290516000926001600160a01b031691636755d7b19160048083019260209291908290030181865afa1580156145bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906145df919061581b565b905060008b6001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa158015614621573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526146499190810190615c27565b6040516020016146599190615cba565b60408051601f1981840301815290829052609d5461e66b60e01b83529092506001600160a01b03169061e66b9061469a908590889088908790600401615d1d565b6020604051808303816000875af11580156146b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906146dd919061581b565b98508b6001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa15801561471d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526147459190810190615c27565b6040516020016147559190615d51565b60408051601f1981840301815290829052609d5461e66b60e01b83529092506001600160a01b03169061e66b90614796908590889088908790600401615d1d565b6020604051808303816000875af11580156147b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906147d9919061581b565b609b546098546040516307379e7760e41b81526001600160a01b03928316600482015290821660248201528e821660448201523060648201528b8216608482015281831660a482015289151560c4820152919950861690637379e7709060e4016020604051808303816000875af1158015614858573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061487c919061581b565b609b5460405163095ea7b360e01b8152919b506001600160a01b03169063095ea7b3906148b1908d906000199060040161592e565b6020604051808303816000875af11580156148d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906148f49190615882565b508860aa60008c6001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055508760ab60008c6001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055508960a760008e6001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055508b60a960008c6001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600160b160008c6001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff021916908315150217905550600160b260008c6001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff02191690831515021790555060a08c9080600181540180825580915050600190039060005260206000200160009091909190916101000a8154816001600160a01b0302191690836001600160a01b0316021790555060a25460a560008c6001600160a01b03166001600160a01b03168152602001908152602001600020819055508b6001600160a01b0316886001600160a01b03168b6001600160a01b03167fa4d97e9e7c65249b4cd01acb82add613adea98af32daf092366982f0a0d4e453338d604051614b5d929190615be1565b60405180910390a4505050505050509250925092565b33614b7c612708565b6001600160a01b0316146116c95760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a1c565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b612dc58363a9059cbb60e01b8484604051602401613fa992919061592e565b6000816001600160a01b03163b11614c6d5760405162461bcd60e51b8152600401610a1c906159b7565b6001600160a01b03828116600081815260aa602090815260409182902054915160018152929385811693921691600080516020615e3b833981519152910160405180910390a46001600160a01b03918216600090815260aa6020526040902080546001600160a01b03191691909216179055565b6000816001600160a01b03163b11614d0b5760405162461bcd60e51b8152600401610a1c906159b7565b6001600160a01b03828116600081815260aa602090815260408083205490519283529293858116931691600080516020615e3b833981519152910160405180910390a46001600160a01b03918216600090815260ab6020526040902080546001600160a01b03191691909216179055565b600054610100900460ff16614da35760405162461bcd60e51b8152600401610a1c90615b96565b6116c933614bd2565b600054610100900460ff16613a745760405162461bcd60e51b8152600401610a1c90615b96565b6000614e28826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614fd59092919063ffffffff16565b805190915015612dc55780806020019051810190614e469190615882565b612dc55760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610a1c565b6001600160a01b03808216600090815260a9602052604081205490911690610708614ece61328c565b614ed891906159da565b600081815260ae602090815260408083206001600160a01b03871684529091529020549091508015614fb3576001600160a01b038416600090815260a560205260408120805460a2549182905591614f3083836159da565b90508015614fab576000670de0b6b3a7640000614f4d83876159f1565b614f579190615a10565b6001600160a01b038916600090815260b2602052604090205490915060ff1615614fa9576001600160a01b038816600090815260a6602052604081208054839290614fa3908490615986565b90915550505b505b50505061202e565b60a2546001600160a01b038516600090815260a5602052604090205550505050565b6060614fe48484600085614fec565b949350505050565b60608247101561504d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610a1c565b600080866001600160a01b031685876040516150699190615d8b565b60006040518083038185875af1925050503d80600081146150a6576040519150601f19603f3d011682016040523d82523d6000602084013e6150ab565b606091505b50915091506150bc878383876150c7565b979650505050505050565b6060831561513457825160000361512d576150e185613581565b61512d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a1c565b5081614fe4565b614fe483838151156151495781518083602001fd5b8060405162461bcd60e51b8152600401610a1c9190615da7565b508054600082559060005260206000209081019061100291905b80821115615191576000815560010161517d565b5090565b6001600160a01b038116811461100257600080fd5b6000602082840312156151bc57600080fd5b81356151c781615195565b9392505050565b6001600160a01b0391909116815260200190565b600080600080600060a086880312156151fa57600080fd5b853561520581615195565b9450602086013561521581615195565b9350604086013561522581615195565b9250606086013561523581615195565b9150608086013561524581615195565b809150509295509295909350565b60008060006060848603121561526857600080fd5b833561527381615195565b9250602084013561528381615195565b929592945050506040919091013590565b6000602082840312156152a657600080fd5b5035919050565b600080604083850312156152c057600080fd5b82356152cb81615195565b915060208301356152db81615195565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715615324576153246152e6565b604052919050565b60006001600160401b03821115615345576153456152e6565b5060051b60200190565b600082601f83011261536057600080fd5b813560206153756153708361532c565b6152fc565b82815260059290921b8401810191818101908684111561539457600080fd5b8286015b848110156153b85780356153ab81615195565b8352918301918301615398565b509695505050505050565b600080604083850312156153d657600080fd5b82356001600160401b03808211156153ed57600080fd5b6153f98683870161534f565b935060209150818501358181111561541057600080fd5b85019050601f8101861361542357600080fd5b80356154316153708261532c565b81815260059190911b8201830190838101908883111561545057600080fd5b928401925b8284101561546e57833582529284019290840190615455565b80955050505050509250929050565b600081518084526020808501945080840160005b838110156154b65781516001600160a01b031687529582019590820190600101615491565b509495945050505050565b6060815260006154d4606083018661547d565b82810360208401526154e6818661547d565b905082810360408401526154fa818561547d565b9695505050505050565b60006020828403121561551657600080fd5b81356001600160401b0381111561552c57600080fd5b614fe48482850161534f565b6000806040838503121561554b57600080fd5b823561555681615195565b946020939093013593505050565b600082601f83011261557557600080fd5b813560206155856153708361532c565b82815260059290921b840181019181810190868411156155a457600080fd5b8286015b848110156153b85780356001600160401b038111156155c75760008081fd5b6155d58986838b010161534f565b8452509183019183016155a8565b6000806000606084860312156155f857600080fd5b83356001600160401b038082111561560f57600080fd5b61561b8783880161534f565b9450602086013591508082111561563157600080fd5b5061563e86828701615564565b925050604084013590509250925092565b6000806040838503121561566257600080fd5b50508035926020909101359150565b60008083601f84011261568357600080fd5b5081356001600160401b0381111561569a57600080fd5b6020830191508360208260051b85010111156156b557600080fd5b9250929050565b6000806000806000606086880312156156d457600080fd5b8535945060208601356001600160401b03808211156156f257600080fd5b6156fe89838a01615671565b9096509450604088013591508082111561571757600080fd5b5061572488828901615671565b969995985093965092949392505050565b6020815260006151c7602083018461547d565b60008060006060848603121561575d57600080fd5b833561576881615195565b9250602084013561577881615195565b9150604084013561578881615195565b809150509250925092565b600080604083850312156157a657600080fd5b82356001600160401b03808211156157bd57600080fd5b6157c98683870161534f565b935060208501359150808211156157df57600080fd5b506157ec85828601615564565b9150509250929050565b6000806040838503121561580957600080fd5b8235915060208301356152db81615195565b60006020828403121561582d57600080fd5b81516151c781615195565b600b81526a2b27aa22a92fa0a226a4a760a91b602082015260400190565b60408152600061586860408301615838565b6001600160a01b0393909316602092909201919091525090565b60006020828403121561589457600080fd5b815180151581146151c757600080fd5b6020815260006158b660208301615838565b92915050565b602080825260059082015264061646472360dc1b604082015260600190565b602080825260049082015263199858dd60e21b604082015260600190565b60208082526005908201526419d19858dd60da1b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b6001600160a01b03929092168252602082015260400190565b6020808252600f908201526e10b0b8383937bb32b217a7bbb732b960891b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b6000821982111561599957615999615970565b500190565b6000600182016159b0576159b0615970565b5060010190565b6020808252600990820152680858dbdb9d1c9858dd60ba1b604082015260600190565b6000828210156159ec576159ec615970565b500390565b6000816000190483118215151615615a0b57615a0b615970565b500290565b600082615a2d57634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215615a4457600080fd5b5051919050565b600060608284031215615a5d57600080fd5b604051606081016001600160401b0381118282101715615a7f57615a7f6152e6565b80604052508251815260208301516020820152604083015160408201528091505092915050565b828152604060208201526000614fe4604083018461547d565b918252602082015260400190565b600a815269474f5645524e414e434560b01b602082015260400190565b60408152600061586860408301615acd565b6020815260006158b660208301615acd565b6020808252600690820152651ada5b1b195960d21b604082015260600190565b60208082526006908201526521676175676560d01b604082015260600190565b6001600160a01b0383168152604060208201819052600090614fe49083018461547d565b60008060408385031215615b8557600080fd5b505080516020909101519092909150565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6001600160a01b0392831681529116602082015260400190565b60005b83811015615c16578181015183820152602001615bfe565b8381111561202e5750506000910152565b600060208284031215615c3957600080fd5b81516001600160401b0380821115615c5057600080fd5b818401915084601f830112615c6457600080fd5b815181811115615c7657615c766152e6565b615c89601f8201601f19166020016152fc565b9150808252856020828501011115615ca057600080fd5b615cb1816020840160208601615bfb565b50949350505050565b6e029bbb0b82c102628102332b2b99d1608d1b815260008251615ce481600f850160208701615bfb565b91909101600f0192915050565b60008151808452615d09816020860160208601615bfb565b601f01601f19169290920160200192915050565b6001600160a01b0385811682528481166020830152831660408201526080606082018190526000906154fa90830184615cf1565b71029bbb0b82c1024b731b2b73a34bb32b99d160751b815260008251615d7e816012850160208701615bfb565b9190910160120192915050565b60008251615d9d818460208701615bfb565b9190910192915050565b6020815260006151c76020830184615cf156fe44da158ba27f9252712a74ff6a55c5d531f69609f1f6e7f17c4443a8e2089be4a1bb19b5d754d8c6479f7761797294f0786b22f6fe2fd51b0b81e56f4136cd93a01124614129d8b1fb8a4fd2f718422cb3d34c92ff59026e1fb316871a2b9c39af85b9071dfafeac1409d3f1d19bafc9bc7c37974cde8df0ee6168f0086e539cddf0ec8cba6dad18edc75774c452fa4201ff17ec1761486329f3321936ce66d0a2646970667358221220ea55034f0b58864efc3528d83a666574ec5cb41ef644e3fe516ff61a812d4fc264736f6c634300080d0033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106103175760003560e01c806306d6a1b21461031c578063075461721461035b5780630f04ba671461036e5780631459457a146103a15780631703e5f9146103b65780631f7b6d32146103d957806327e5c823146103eb578063310bd74b146103fe57806332145f901461041157806333832a6a1461042457806334b896f21461043757806338752a9d1461044a5780633c6b16ab1461045d578063402914f514610470578063436596c414610490578063470f4985146104985780634d68ce44146104a057806353be568d146104c2578063575a86b2146104e2578063577387b5146104f55780636138889b14610508578063636056f21461051b5780636447e7da146105505780636566afad14610570578063657021fb14610583578063666256aa146105a65780636c4f2e38146105b9578063715018a6146105e05780637625391a146105e85780637715ee75146105fb5780637964bac91461060e5780637ac09bf7146106215780638980f11f146106345780638b6fc247146106475780638da5cb5b1461065a5780638dd598fb1461066257806390e934161461067557806396c82e571461068a578063992a7933146106925780639f06247b146106a5578063a42bbccd146106b8578063a7cac846146106d8578063a86a366d146106eb578063a9b5aa7e146106fe578063aa79979b14610711578063ac4afa3814610734578063ae21c4cb14610747578063b0f5027814610770578063b52a315114610783578063b55a5c1c1461078b578063b7c89f9c1461079e578063b9a09fd5146107b1578063c2b79e98146107da578063c445d88a146107ed578063c45a01551461080d578063c527ee1f14610820578063c991866d14610833578063d23254b414610846578063daa168bd14610871578063dcd9e47a14610884578063eae40f26146108c1578063f2fde38b146108ea578063f3594be0146108fd578063f3c9c3861461091d578063f8803bb61461093d578063f9f031df14610945578063fca3b5aa14610958578063fe5b38e41461096b578063ffe5195b14610973575b600080fd5b61034561032a3660046151aa565b60a9602052600090815260409020546001600160a01b031681565b60405161035291906151ce565b60405180910390f35b609e54610345906001600160a01b031681565b61039161037c3660046151aa565b60b36020526000908152604090205460ff1681565b6040519015158152602001610352565b6103b46103af3660046151e2565b61097c565b005b6103916103c43660046151aa565b60b26020526000908152604090205460ff1681565b60a0545b604051908152602001610352565b6103b46103f9366004615253565b610bf8565b6103b461040c366004615294565b610ecf565b6103b461041f366004615294565b611005565b6103b46104323660046151aa565b61121d565b6103b46104453660046152ad565b611356565b609d54610345906001600160a01b031681565b6103b461046b366004615294565b611430565b6103dd61047e3660046151aa565b60a66020526000908152604090205481565b6103b4611556565b609a546103dd565b6104b36104ae3660046153c3565b6116cb565b604051610352939291906154c1565b6103dd6104d0366004615294565b600090815260af602052604090205490565b60a154610345906001600160a01b031681565b6103b4610503366004615294565b611901565b6103b4610516366004615504565b611b72565b6103dd610529366004615538565b600090815260ae602090815260408083206001600160a01b03949094168352929052205490565b6103dd61055e366004615294565b600090815260ad602052604090205490565b6103b461057e3660046152ad565b611cb9565b6103916105913660046151aa565b60b46020526000908152604090205460ff1681565b6103b46105b43660046155e3565b611eee565b6103dd7f000000000000000000000000000000000000000000000000000000000000070881565b6103b4612034565b6103b46105f636600461564f565b612046565b6103b46106093660046155e3565b612187565b6103b461061c3660046151aa565b6122c7565b6103b461062f3660046156bc565b612376565b6103b4610642366004615538565b6124ff565b6103b4610655366004615294565b6125a0565b610345612708565b609854610345906001600160a01b031681565b61067d612717565b6040516103529190615735565b6103dd612779565b6103b46106a03660046151aa565b612799565b6103b46106b33660046151aa565b61292b565b6103dd6106c6366004615294565b600090815260a4602052604090205490565b6103dd6106e63660046151aa565b612af0565b6103456106f936600461564f565b612b27565b6103b461070c3660046151aa565b612b5f565b61039161071f3660046151aa565b60b16020526000908152604090205460ff1681565b610345610742366004615294565b612c98565b6103456107553660046151aa565b60ab602052600090815260409020546001600160a01b031681565b6103b461077e366004615748565b612cc2565b609c546103dd565b609f54610345906001600160a01b031681565b6103b46107ac3660046152ad565b612dca565b6103456107bf3660046151aa565b60a7602052600090815260409020546001600160a01b031681565b6103b46107e8366004615793565b612e99565b6103dd6107fb3660046151aa565b60a86020526000908152604090205481565b609954610345906001600160a01b031681565b6103b461082e366004615504565b612f4a565b6103b4610841366004615793565b61306e565b6103dd6108543660046157f6565b60ac60209081526000928352604080842090915290825290205481565b6103b461087f3660046152ad565b61311f565b610897610892366004615538565b6131ee565b604080516001600160a01b0394851681529284166020840152921691810191909152606001610352565b6103456108cf3660046151aa565b60aa602052600090815260409020546001600160a01b031681565b6103b46108f83660046151aa565b613216565b6103dd61090b366004615294565b60b06020526000908152604090205481565b6103dd61092b3660046151aa565b60b56020526000908152604090205481565b6103dd61328c565b6103b4610953366004615504565b613352565b6103b46109663660046151aa565b6133e8565b61067d613521565b6103dd60a35481565b600054610100900460ff161580801561099c5750600054600160ff909116105b806109bd57506109ab30613581565b1580156109bd575060005460ff166001145b610a255760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff191660011790558015610a48576000805461ff0019166101001790555b610a50613590565b610a586135bf565b609880546001600160a01b0319166001600160a01b03881690811790915560408051637e062a3560e11b8152905163fc0c546a916004808201926020929091908290030181865afa158015610ab1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ad5919061581b565b609b80546001600160a01b03199081166001600160a01b0393841617909155609a80546001818101909255600080516020615dbb8339815191520180548316898516908117909155600090815260b360209081526040808320805460ff199081168617909155609c8054808701909155600080516020615e1b83398151915201805487168c8916908117909155845260b490925290912080549091169091179055609d80548216868416179055609e8054339083168117909155609f80548316909117905560a180549091169184169190911790558015610bf0576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050565b609f54604051634448e1eb60e01b81526001600160a01b0390911690634448e1eb90610c28903390600401615856565b602060405180830381865afa158015610c45573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c699190615882565b610c855760405162461bcd60e51b8152600401610a1c906158a4565b6001600160a01b038316610cab5760405162461bcd60e51b8152600401610a1c906158bc565b6001600160a01b038216610cd15760405162461bcd60e51b8152600401610a1c906158bc565b6001600160a01b038316600090815260b3602052604090205460ff1615610d0a5760405162461bcd60e51b8152600401610a1c906158db565b6001600160a01b038216600090815260b4602052604090205460ff1615610d435760405162461bcd60e51b8152600401610a1c906158f9565b6000609a8281548110610d5857610d58615918565b6000918252602082200154609c80546001600160a01b0390921693509084908110610d8557610d85615918565b60009182526020808320909101546001600160a01b03858116845260b383526040808520805460ff199081169091559190921680855260b490935292208054909216909155609a8054919250869185908110610de357610de3615918565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555083609c8481548110610e2557610e25615918565b600091825260208083209190910180546001600160a01b0319166001600160a01b03948516179055878316825260b381526040808320805460ff19908116600190811790925589861680865260b490945282852080549091169091179055519092841691600080516020615ddb83398151915291a3846001600160a01b0316826001600160a01b0316600080516020615dfb83398151915260405160405180910390a35050505050565b610ed76135ee565b610ee081613647565b60985460405163430c208160e01b81526001600160a01b039091169063430c208190610f12903390859060040161592e565b602060405180830381865afa158015610f2f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f539190615882565b610f6f5760405162461bcd60e51b8152600401610a1c90615947565b610f78816136a3565b60985460405163c1f0fb9f60e01b8152600481018390526001600160a01b039091169063c1f0fb9f90602401600060405180830381600087803b158015610fbe57600080fd5b505af1158015610fd2573d6000803e3d6000fd5b50505050610fde61328c565b610fe9906001615986565b600082815260b060205260409020556110026001606555565b50565b61100d6135ee565b61101681613647565b60985460405163430c208160e01b81526001600160a01b039091169063430c208190611048903390859060040161592e565b602060405180830381865afa158015611065573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110899190615882565b6110a55760405162461bcd60e51b8152600401610a1c90615947565b600081815260ad602090815260408083208054825181850281018501909352808352919290919083018282801561110557602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116110e7575b505050505090506000815190506000816001600160401b0381111561112c5761112c6152e6565b604051908082528060200260200182016040528015611155578160200160208202803683370190505b50905060005b828110156111e25760ac6000868152602001908152602001600020600085838151811061118a5761118a615918565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020548282815181106111c5576111c5615918565b6020908102919091010152806111da8161599e565b91505061115b565b506111ee848483613a7b565b6111f661328c565b611201906001615986565b600085815260b06020526040902055506110029150613a749050565b609f54604051634448e1eb60e01b81526001600160a01b0390911690634448e1eb9061124d903390600401615856565b602060405180830381865afa15801561126a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061128e9190615882565b6112aa5760405162461bcd60e51b8152600401610a1c906158a4565b6000816001600160a01b03163b116112d45760405162461bcd60e51b8152600401610a1c906159b7565b6001600160a01b0381166112fa5760405162461bcd60e51b8152600401610a1c906158bc565b609f546040516001600160a01b038084169216907f19fff1a4baaea69caec27e064bdfc0cb61d642370694fffdc0d38a568eb89b7390600090a3609f80546001600160a01b0319166001600160a01b0392909216919091179055565b609e546001600160a01b03163314806113db5750609f54604051634448e1eb60e01b81526001600160a01b0390911690634448e1eb9061139a903390600401615856565b602060405180830381865afa1580156113b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113db9190615882565b6113e457600080fd5b609754156113f157600080fd5b609e80546001600160a01b038084166001600160a01b031992831617909255609f80549285169290911691909117905561142961328c565b6097555050565b609e546001600160a01b031633146114745760405162461bcd60e51b815260206004820152600760248201526610b6b4b73a32b960c91b6044820152606401610a1c565b600061070861148161328c565b61148b91906159da565b600081815260af602052604081205491925081156114db57609b546114bb906001600160a01b0316333087613f75565b816114ce85670de0b6b3a76400006159f1565b6114d89190615a10565b90505b801561150b578060a260008282546114f39190615986565b909155505060a254600084815260a460205260409020555b609b546040518581526001600160a01b039091169033907ff70d5c697de7ea828df48e5c4573cb2194c659f1901f70110c52b066dcf50826906020015b60405180910390a350505050565b61155e6135ee565b609e60009054906101000a90046001600160a01b03166001600160a01b031663ed29fc116040518163ffffffff1660e01b81526004016020604051808303816000875af11580156115b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115d79190615a32565b5060a160009054906101000a90046001600160a01b03166001600160a01b031663e3161ddd6040518163ffffffff1660e01b81526004016060604051808303816000875af115801561162d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116519190615a4b565b5060a0546000905b808210156116bd576116ab60a7600060a0858154811061167b5761167b615918565b60009182526020808320909101546001600160a01b03908116845290830193909352604090910190205416613fe0565b816116b58161599e565b925050611659565b50506116c96001606555565b565b60608060606116d86135ee565b83518551146117185760405162461bcd60e51b815260206004820152600c60248201526b0d8cadc40dad2e6dac2e8c6d60a31b6044820152606401610a1c565b600a855111156117535760405162461bcd60e51b815260206004820152600660248201526506d61782031360d41b6044820152606401610a1c565b600085516001600160401b0381111561176e5761176e6152e6565b604051908082528060200260200182016040528015611797578160200160208202803683370190505b509050600086516001600160401b038111156117b5576117b56152e6565b6040519080825280602002602001820160405280156117de578160200160208202803683370190505b509050600087516001600160401b038111156117fc576117fc6152e6565b604051908082528060200260200182016040528015611825578160200160208202803683370190505b50905060005b88518110156118e85761187089828151811061184957611849615918565b602002602001015189838151811061186357611863615918565b602002602001015161411d565b86848151811061188257611882615918565b6020026020010186858151811061189b5761189b615918565b602002602001018686815181106118b4576118b4615918565b6001600160a01b039485166020918202929092010152928216909252919091169052806118e08161599e565b91505061182b565b50919450925090506118fa6001606555565b9250925092565b609f54604051634448e1eb60e01b81526001600160a01b0390911690634448e1eb90611931903390600401615856565b602060405180830381865afa15801561194e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119729190615882565b61198e5760405162461bcd60e51b8152600401610a1c906158a4565b6000609a82815481106119a3576119a3615918565b6000918252602082200154609c80546001600160a01b03909216935090849081106119d0576119d0615918565b60009182526020808320909101546001600160a01b03858116845260b39092526040909220549116915060ff16611a315760405162461bcd60e51b815260206004820152600560248201526408599858dd60da1b6044820152606401610a1c565b6001600160a01b038116600090815260b4602052604090205460ff16611a825760405162461bcd60e51b81526020600482015260066024820152650859d19858dd60d21b6044820152606401610a1c565b6000609a8481548110611a9757611a97615918565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506000609c8481548110611ada57611ada615918565b600091825260208083209190910180546001600160a01b0319166001600160a01b03948516179055848316825260b381526040808320805460ff1990811690915593851680845260b490925280832080549094169093559151909190600080516020615ddb833981519152908390a36040516000906001600160a01b03841690600080516020615dfb833981519152908390a3505050565b611b7a6135ee565b609e60009054906101000a90046001600160a01b03166001600160a01b031663ed29fc116040518163ffffffff1660e01b81526004016020604051808303816000875af1158015611bcf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bf39190615a32565b5060a160009054906101000a90046001600160a01b03166001600160a01b031663e3161ddd6040518163ffffffff1660e01b81526004016060604051808303816000875af1158015611c49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c6d9190615a4b565b5060005b8151811015611cae57611c9c828281518110611c8f57611c8f615918565b6020026020010151613fe0565b80611ca68161599e565b915050611c71565b506110026001606555565b609f54604051634448e1eb60e01b81526001600160a01b0390911690634448e1eb90611ce9903390600401615856565b602060405180830381865afa158015611d06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d2a9190615882565b611d465760405162461bcd60e51b8152600401610a1c906158a4565b6001600160a01b038216611d6c5760405162461bcd60e51b8152600401610a1c906158bc565b6001600160a01b038116611d925760405162461bcd60e51b8152600401610a1c906158bc565b6001600160a01b038216600090815260b3602052604090205460ff1615611dcb5760405162461bcd60e51b8152600401610a1c906158db565b6001600160a01b038116600090815260b4602052604090205460ff1615611e045760405162461bcd60e51b8152600401610a1c906158f9565b6000816001600160a01b03163b11611e2e5760405162461bcd60e51b8152600401610a1c906159b7565b609a80546001818101909255600080516020615dbb8339815191520180546001600160a01b038086166001600160a01b03199283168117909355609c8054808601909155600080516020615e1b833981519152018054918616919092168117909155600082815260b360209081526040808320805460ff19908116881790915584845260b490925280832080549092169095179055925190927f8bad2b894999c82738dc185dbb158d846fce35d7edbcc0661b1b97d9aacba69d91a35050565b60985460405163430c208160e01b81526001600160a01b039091169063430c208190611f20903390859060040161592e565b602060405180830381865afa158015611f3d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f619190615882565b611f7d5760405162461bcd60e51b8152600401610a1c90615947565b60005b835181101561202e57838181518110611f9b57611f9b615918565b60200260200101516001600160a01b031663a7852afa83858481518110611fc457611fc4615918565b60200260200101516040518363ffffffff1660e01b8152600401611fe9929190615aa6565b600060405180830381600087803b15801561200357600080fd5b505af1158015612017573d6000803e3d6000fd5b5050505080806120269061599e565b915050611f80565b50505050565b61203c614b73565b6116c96000614bd2565b61204e6135ee565b609e60009054906101000a90046001600160a01b03166001600160a01b031663ed29fc116040518163ffffffff1660e01b81526004016020604051808303816000875af11580156120a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120c79190615a32565b5060a160009054906101000a90046001600160a01b03166001600160a01b031663e3161ddd6040518163ffffffff1660e01b81526004016060604051808303816000875af115801561211d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121419190615a4b565b50815b818110156121785761216660a7600060a0848154811061167b5761167b615918565b806121708161599e565b915050612144565b506121836001606555565b5050565b60985460405163430c208160e01b81526001600160a01b039091169063430c2081906121b9903390859060040161592e565b602060405180830381865afa1580156121d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121fa9190615882565b6122165760405162461bcd60e51b8152600401610a1c90615947565b60005b835181101561202e5783818151811061223457612234615918565b60200260200101516001600160a01b031663a7852afa8385848151811061225d5761225d615918565b60200260200101516040518363ffffffff1660e01b8152600401612282929190615aa6565b600060405180830381600087803b15801561229c57600080fd5b505af11580156122b0573d6000803e3d6000fd5b5050505080806122bf9061599e565b915050612219565b609f54604051634448e1eb60e01b81526001600160a01b0390911690634448e1eb906122f7903390600401615856565b602060405180830381865afa158015612314573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123389190615882565b6123545760405162461bcd60e51b8152600401610a1c906158a4565b609980546001600160a01b0319166001600160a01b0392909216919091179055565b61237e6135ee565b61238785613647565b60985460405163430c208160e01b81526001600160a01b039091169063430c2081906123b9903390899060040161592e565b602060405180830381865afa1580156123d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123fa9190615882565b6124165760405162461bcd60e51b8152600401610a1c90615947565b82811461245e5760405162461bcd60e51b8152602060048201526016602482015275506f6f6c2f57656967687473206c656e67746820213d60501b6044820152606401610a1c565b6124cc8585858080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020808902828101820190935288825290935088925087918291850190849080828437600092019190915250613a7b92505050565b6124d461328c565b6124df906001615986565b600086815260b060205260409020556124f86001606555565b5050505050565b609f54604051634448e1eb60e01b81526001600160a01b0390911690634448e1eb9061252f903390600401615856565b602060405180830381865afa15801561254c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125709190615882565b61258c5760405162461bcd60e51b8152600401610a1c906158a4565b6121836001600160a01b0383163383614c24565b609f54604051634448e1eb60e01b81526001600160a01b0390911690634448e1eb906125d0903390600401615856565b602060405180830381865afa1580156125ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126119190615882565b61262d5760405162461bcd60e51b8152600401610a1c906158a4565b60a354810361266c5760405162461bcd60e51b815260206004820152600b60248201526a185b1c9958591e481cd95d60aa1b6044820152606401610a1c565b7f00000000000000000000000000000000000000000000000000000000000007088111156126c85760405162461bcd60e51b81526020600482015260096024820152686d61782064656c617960b81b6044820152606401610a1c565b7f17fb843f25faf2431510bc4a71e4898ccc1a28a3e985450e509670d14be2eaa160a354826040516126fb929190615abf565b60405180910390a160a355565b6033546001600160a01b031690565b6060609c80548060200260200160405190810160405280929190818152602001828054801561276f57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612751575b5050505050905090565b60008061278461328c565b600090815260af602052604090205492915050565b609f54604051634448e1eb60e01b81526001600160a01b0390911690634448e1eb906127c9903390600401615aea565b602060405180830381865afa1580156127e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061280a9190615882565b6128265760405162461bcd60e51b8152600401610a1c90615afc565b6001600160a01b038116600090815260b2602052604090205460ff1661285e5760405162461bcd60e51b8152600401610a1c90615b0e565b6001600160a01b038116600090815260b260209081526040808320805460ff1916905560a6909152812081905561289361328c565b600081815260ae602090815260408083206001600160a01b03808816855260a984528285205416845282528083205484845260af9092528220805493945090929091906128e19084906159da565b90915550506001600160a01b038216600081815260b56020526040808220849055517f04a5d3f5d80d22d9345acc80618f4a4e7e663cf9e1aed23b57d975acec002ba79190a25050565b609f54604051634448e1eb60e01b81526001600160a01b0390911690634448e1eb9061295b903390600401615aea565b602060405180830381865afa158015612978573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061299c9190615882565b6129b85760405162461bcd60e51b8152600401610a1c90615afc565b6001600160a01b038116600090815260b2602052604090205460ff1615612a095760405162461bcd60e51b8152602060048201526005602482015264616c69766560d81b6044820152606401610a1c565b6001600160a01b038116600090815260b1602052604090205460ff16612a415760405162461bcd60e51b8152600401610a1c90615b0e565b6001600160a01b038116600090815260b56020526040902054612a6261328c565b11612a975760405162461bcd60e51b81526020600482015260056024820152646561726c7960d81b6044820152606401610a1c565b6001600160a01b038116600081815260b260209081526040808320805460ff1916600117905560b5909152808220829055517fed18e9faa3dccfd8aa45f69c4de40546b2ca9cccc4538a2323531656516db1aa9190a250565b600080612afb61328c565b600090815260ae602090815260408083206001600160a01b039096168352949052929092205492915050565b60ad6020528160005260406000208181548110612b4357600080fd5b6000918252602090912001546001600160a01b03169150829050565b609f54604051634448e1eb60e01b81526001600160a01b0390911690634448e1eb90612b8f903390600401615856565b602060405180830381865afa158015612bac573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bd09190615882565b612bec5760405162461bcd60e51b8152600401610a1c906158a4565b6000816001600160a01b03163b11612c165760405162461bcd60e51b8152600401610a1c906159b7565b6001600160a01b038116612c3c5760405162461bcd60e51b8152600401610a1c906158bc565b609d546040516001600160a01b038084169216907f03ab94e51ce1ec8483c05c7425f6ebc27289fbd4a9c8b6ba0c2fe3b8b01765d490600090a3609d80546001600160a01b0319166001600160a01b0392909216919091179055565b60a08181548110612ca857600080fd5b6000918252602090912001546001600160a01b0316905081565b609f54604051634448e1eb60e01b81526001600160a01b0390911690634448e1eb90612cf2903390600401615856565b602060405180830381865afa158015612d0f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d339190615882565b612d4f5760405162461bcd60e51b8152600401610a1c906158a4565b6001600160a01b038316600090815260b1602052604090205460ff16612d875760405162461bcd60e51b8152600401610a1c90615b2e565b6000836001600160a01b03163b11612db15760405162461bcd60e51b8152600401610a1c906159b7565b612dbb8383614c43565b612dc58382614ce1565b505050565b609f54604051634448e1eb60e01b81526001600160a01b0390911690634448e1eb90612dfa903390600401615856565b602060405180830381865afa158015612e17573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e3b9190615882565b612e575760405162461bcd60e51b8152600401610a1c906158a4565b6001600160a01b038216600090815260b1602052604090205460ff16612e8f5760405162461bcd60e51b8152600401610a1c90615b2e565b6121838282614c43565b60005b8251811015612dc557828181518110612eb757612eb7615918565b60200260200101516001600160a01b031663db0ea98433848481518110612ee057612ee0615918565b60200260200101516040518363ffffffff1660e01b8152600401612f05929190615b4e565b600060405180830381600087803b158015612f1f57600080fd5b505af1158015612f33573d6000803e3d6000fd5b505050508080612f429061599e565b915050612e9c565b60005b81518110156121835760b16000838381518110612f6c57612f6c615918565b6020908102919091018101516001600160a01b031682528101919091526040016000205460ff168015612fd8575060b26000838381518110612fb057612fb0615918565b6020908102919091018101516001600160a01b031682528101919091526040016000205460ff165b1561305c57818181518110612fef57612fef615918565b60200260200101516001600160a01b031663d294f0936040518163ffffffff1660e01b815260040160408051808303816000875af1158015613035573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130599190615b72565b50505b806130668161599e565b915050612f4d565b60005b8251811015612dc55782818151811061308c5761308c615918565b60200260200101516001600160a01b031663db0ea984338484815181106130b5576130b5615918565b60200260200101516040518363ffffffff1660e01b81526004016130da929190615b4e565b600060405180830381600087803b1580156130f457600080fd5b505af1158015613108573d6000803e3d6000fd5b5050505080806131179061599e565b915050613071565b609f54604051634448e1eb60e01b81526001600160a01b0390911690634448e1eb9061314f903390600401615856565b602060405180830381865afa15801561316c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131909190615882565b6131ac5760405162461bcd60e51b8152600401610a1c906158a4565b6001600160a01b038216600090815260b1602052604090205460ff166131e45760405162461bcd60e51b8152600401610a1c90615b2e565b6121838282614ce1565b60008060006131fb6135ee565b613205858561411d565b919450925090506118fa6001606555565b61321e614b73565b6001600160a01b0381166132835760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a1c565b61100281614bd2565b600080609e60009054906101000a90046001600160a01b03166001600160a01b031663d13996086040518163ffffffff1660e01b8152600401602060405180830381865afa1580156132e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133069190615a32565b90508060000361334d5760405162461bcd60e51b81526020600482015260126024820152714e6f7420737461727465642065706f63687360701b6044820152606401610a1c565b919050565b60005b81518110156121835781818151811061337057613370615918565b60200260200101516001600160a01b031663c00007b0336040518263ffffffff1660e01b81526004016133a391906151ce565b600060405180830381600087803b1580156133bd57600080fd5b505af11580156133d1573d6000803e3d6000fd5b5050505080806133e09061599e565b915050613355565b609f54604051634448e1eb60e01b81526001600160a01b0390911690634448e1eb90613418903390600401615856565b602060405180830381865afa158015613435573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134599190615882565b6134755760405162461bcd60e51b8152600401610a1c906158a4565b6001600160a01b03811661349b5760405162461bcd60e51b8152600401610a1c906158bc565b6000816001600160a01b03163b116134c55760405162461bcd60e51b8152600401610a1c906159b7565b609e546040516001600160a01b038084169216907fe490d3138e32f1f66ef3971a3c73c7f7704ba0c1d1000f1e2c3df6fc0376610b90600090a3609e80546001600160a01b0319166001600160a01b0392909216919091179055565b6060609a80548060200260200160405190810160405280929190818152602001828054801561276f576020028201919060005260206000209081546001600160a01b03168152600190910190602001808311612751575050505050905090565b6001600160a01b03163b151590565b600054610100900460ff166135b75760405162461bcd60e51b8152600401610a1c90615b96565b6116c9614d7c565b600054610100900460ff166135e65760405162461bcd60e51b8152600401610a1c90615b96565b6116c9614dac565b6002606554036136405760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610a1c565b6002606555565b60a354600082815260b060205260409020546136639190615986565b42116110025760405162461bcd60e51b815260206004820152600f60248201526e4552523a20564f54455f44454c415960881b6044820152606401610a1c565b600081815260ad6020526040812080549091806136be61328c565b90506000836001600160401b038111156136da576136da6152e6565b604051908082528060200260200182016040528015613703578160200160208202803683370190505b5090506000805b858110156139e25786818154811061372457613724615918565b60009182526020808320909101548a835260ac825260408084206001600160a01b039092168085529190925291205484519193509084908390811061376b5761376b615918565b60200260200101818152505082818151811061378957613789615918565b60200260200101516000146139da57600088815260b060205260409020548410156137f6578281815181106137c0576137c0615918565b602090810291909101810151600086815260ae835260408082206001600160a01b03871683529093529190912080549190910390555b82818151811061380857613808615918565b60209081029190910181015160008a815260ac835260408082206001600160a01b038716835284528082208054939093039092558a815260b090925290205484101561398b576001600160a01b03808316600090815260a760209081526040808320548416835260aa9091529020548451911690639e2bf22c9085908490811061389457613894615918565b60200260200101518a6040518363ffffffff1660e01b81526004016138ba929190615abf565b600060405180830381600087803b1580156138d457600080fd5b505af11580156138e8573d6000803e3d6000fd5b5050506001600160a01b03808416600090815260a760209081526040808320548416835260ab909152902054855191169150639e2bf22c9085908490811061393257613932615918565b60200260200101518a6040518363ffffffff1660e01b8152600401613958929190615abf565b600060405180830381600087803b15801561397257600080fd5b505af1158015613986573d6000803e3d6000fd5b505050505b6001600160a01b03808316600090815260a76020908152604080832054909316825260b29052205460ff16156139da578281815181106139cd576139cd615918565b6020026020010151850194505b60010161370a565b50600087815260b060205260409020548311156139fe57600093505b600083815260af602052604081208054869290613a1c9084906159da565b9091555050600087815260ad60205260408120613a3891615163565b6040518781527fa7162958659bd0c96888ff99c33ec75cbfb9ae5087ba44fcae10a873305ef5249060200160405180910390a150505050505050565b6001606555565b613a84836136a3565b81516098546040516339f890b560e21b8152600481018690526000916001600160a01b03169063e7e242d490602401602060405180830381865afa158015613ad0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613af49190615a32565b9050600080600080613b0461328c565b905060005b86811015613ba85760b2600060a760008c8581518110613b2b57613b2b615918565b6020908102919091018101516001600160a01b0390811683528282019390935260409182016000908120549093168452830193909352910190205460ff1615613b9657878181518110613b8057613b80615918565b602002602001015185613b939190615986565b94505b80613ba08161599e565b915050613b09565b5060005b86811015613ee1576000898281518110613bc857613bc8615918565b6020908102919091018101516001600160a01b03808216600090815260a7845260408082205490921680825260b1909452205490925060ff168015613c2557506001600160a01b038116600090815260b2602052604090205460ff165b15613ecc57600087898c8681518110613c4057613c40615918565b6020026020010151613c5291906159f1565b613c5c9190615a10565b60008e815260ac602090815260408083206001600160a01b038816845290915290205490915015613c8c57600080fd5b80600003613c9957600080fd5b60008d815260ad6020908152604080832080546001810182559084528284200180546001600160a01b0319166001600160a01b03881690811790915588845260ae835281842090845290915281208054839290613cf7908490615986565b909155505060008d815260ac602090815260408083206001600160a01b038716845290915281208054839290613d2e908490615986565b9250508190555060aa6000836001600160a01b03166001600160a01b0316815260200190815260200160002060009054906101000a90046001600160a01b03166001600160a01b031663f3207723828f6040518363ffffffff1660e01b8152600401613d9b929190615abf565b600060405180830381600087803b158015613db557600080fd5b505af1158015613dc9573d6000803e3d6000fd5b5050505060ab6000836001600160a01b03166001600160a01b0316815260200190815260200160002060009054906101000a90046001600160a01b03166001600160a01b031663f3207723828f6040518363ffffffff1660e01b8152600401613e33929190615abf565b600060405180830381600087803b158015613e4d57600080fd5b505af1158015613e61573d6000803e3d6000fd5b505050508086613e719190615986565b9550613e7d8188615986565b604080518f8152602081018490526001600160a01b03861681830152905191985033917ffdaa0bde29644a3131ccc1c258e3b291894018a4fb5d46c8f494c80256e35ec59181900360600190a2505b50508080613ed99061599e565b915050613bac565b508115613f475760985460405163fd4a77f160e01b8152600481018b90526001600160a01b039091169063fd4a77f190602401600060405180830381600087803b158015613f2e57600080fd5b505af1158015613f42573d6000803e3d6000fd5b505050505b600081815260af602052604081208054859290613f65908490615986565b9091555050505050505050505050565b6040516001600160a01b038085166024830152831660448201526064810182905261202e9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614dd3565b6001600160a01b038116600090815260a860205260408120549061400261328c565b905080821015612dc55761401583614ea5565b6001600160a01b038316600090815260a66020526040902054801580159061405557506001600160a01b038416600090815260b2602052604090205460ff165b1561202e576001600160a01b03808516600081815260a66020908152604080832083905560a890915290819020859055609b54905163b66503cf60e01b8152919263b66503cf926140ae9290911690859060040161592e565b600060405180830381600087803b1580156140c857600080fd5b505af11580156140dc573d6000803e3d6000fd5b50506040518381526001600160a01b03871692503391507f4fa9693cae526341d334e2862ca2413b2e503f1266255f9e0869fb36e6d89b1790602001611548565b609f54604051634448e1eb60e01b8152600091829182916001600160a01b031690634448e1eb90614152903390600401615aea565b602060405180830381865afa15801561416f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906141939190615882565b61419c57600080fd5b609a5484106141d95760405162461bcd60e51b815260206004820152600960248201526867617567657479706560b81b6044820152606401610a1c565b6001600160a01b03858116600090815260a76020526040902054161561422b5760405162461bcd60e51b81526020600482015260076024820152662165786973747360c81b6044820152606401610a1c565b6000856001600160a01b03163b116142555760405162461bcd60e51b8152600401610a1c906159b7565b600080609a868154811061426b5761426b615918565b6000918252602082200154609c80546001600160a01b039092169350908890811061429857614298615918565b6000918252602090912001546001600160a01b03908116915082166142cf5760405162461bcd60e51b8152600401610a1c906158bc565b6001600160a01b0381166142f55760405162461bcd60e51b8152600401610a1c906158bc565b600080896001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015614336573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061435a919061581b565b9150896001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561439a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143be919061581b565b9050886000036144385760405163e5e31b1360e01b81526001600160a01b0385169063e5e31b13906143f4908d906004016151ce565b602060405180830381865afa158015614411573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906144359190615882565b94505b886001036145715760405163d9a641e160e01b81526000906001600160a01b0386169063d9a641e1906144719086908690600401615be1565b602060405180830381865afa15801561448e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906144b2919061581b565b905060008b6001600160a01b03166316f0115b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156144f4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614518919061581b565b9050816001600160a01b0316816001600160a01b03161461456a5760405162461bcd60e51b815260206004820152600c60248201526b77726f6e6720746f6b656e7360a01b6044820152606401610a1c565b6001965050505b609f5460408051636755d7b160e01b815290516000926001600160a01b031691636755d7b19160048083019260209291908290030181865afa1580156145bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906145df919061581b565b905060008b6001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa158015614621573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526146499190810190615c27565b6040516020016146599190615cba565b60408051601f1981840301815290829052609d5461e66b60e01b83529092506001600160a01b03169061e66b9061469a908590889088908790600401615d1d565b6020604051808303816000875af11580156146b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906146dd919061581b565b98508b6001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa15801561471d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526147459190810190615c27565b6040516020016147559190615d51565b60408051601f1981840301815290829052609d5461e66b60e01b83529092506001600160a01b03169061e66b90614796908590889088908790600401615d1d565b6020604051808303816000875af11580156147b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906147d9919061581b565b609b546098546040516307379e7760e41b81526001600160a01b03928316600482015290821660248201528e821660448201523060648201528b8216608482015281831660a482015289151560c4820152919950861690637379e7709060e4016020604051808303816000875af1158015614858573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061487c919061581b565b609b5460405163095ea7b360e01b8152919b506001600160a01b03169063095ea7b3906148b1908d906000199060040161592e565b6020604051808303816000875af11580156148d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906148f49190615882565b508860aa60008c6001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055508760ab60008c6001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055508960a760008e6001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055508b60a960008c6001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600160b160008c6001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff021916908315150217905550600160b260008c6001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff02191690831515021790555060a08c9080600181540180825580915050600190039060005260206000200160009091909190916101000a8154816001600160a01b0302191690836001600160a01b0316021790555060a25460a560008c6001600160a01b03166001600160a01b03168152602001908152602001600020819055508b6001600160a01b0316886001600160a01b03168b6001600160a01b03167fa4d97e9e7c65249b4cd01acb82add613adea98af32daf092366982f0a0d4e453338d604051614b5d929190615be1565b60405180910390a4505050505050509250925092565b33614b7c612708565b6001600160a01b0316146116c95760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a1c565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b612dc58363a9059cbb60e01b8484604051602401613fa992919061592e565b6000816001600160a01b03163b11614c6d5760405162461bcd60e51b8152600401610a1c906159b7565b6001600160a01b03828116600081815260aa602090815260409182902054915160018152929385811693921691600080516020615e3b833981519152910160405180910390a46001600160a01b03918216600090815260aa6020526040902080546001600160a01b03191691909216179055565b6000816001600160a01b03163b11614d0b5760405162461bcd60e51b8152600401610a1c906159b7565b6001600160a01b03828116600081815260aa602090815260408083205490519283529293858116931691600080516020615e3b833981519152910160405180910390a46001600160a01b03918216600090815260ab6020526040902080546001600160a01b03191691909216179055565b600054610100900460ff16614da35760405162461bcd60e51b8152600401610a1c90615b96565b6116c933614bd2565b600054610100900460ff16613a745760405162461bcd60e51b8152600401610a1c90615b96565b6000614e28826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614fd59092919063ffffffff16565b805190915015612dc55780806020019051810190614e469190615882565b612dc55760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610a1c565b6001600160a01b03808216600090815260a9602052604081205490911690610708614ece61328c565b614ed891906159da565b600081815260ae602090815260408083206001600160a01b03871684529091529020549091508015614fb3576001600160a01b038416600090815260a560205260408120805460a2549182905591614f3083836159da565b90508015614fab576000670de0b6b3a7640000614f4d83876159f1565b614f579190615a10565b6001600160a01b038916600090815260b2602052604090205490915060ff1615614fa9576001600160a01b038816600090815260a6602052604081208054839290614fa3908490615986565b90915550505b505b50505061202e565b60a2546001600160a01b038516600090815260a5602052604090205550505050565b6060614fe48484600085614fec565b949350505050565b60608247101561504d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610a1c565b600080866001600160a01b031685876040516150699190615d8b565b60006040518083038185875af1925050503d80600081146150a6576040519150601f19603f3d011682016040523d82523d6000602084013e6150ab565b606091505b50915091506150bc878383876150c7565b979650505050505050565b6060831561513457825160000361512d576150e185613581565b61512d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a1c565b5081614fe4565b614fe483838151156151495781518083602001fd5b8060405162461bcd60e51b8152600401610a1c9190615da7565b508054600082559060005260206000209081019061100291905b80821115615191576000815560010161517d565b5090565b6001600160a01b038116811461100257600080fd5b6000602082840312156151bc57600080fd5b81356151c781615195565b9392505050565b6001600160a01b0391909116815260200190565b600080600080600060a086880312156151fa57600080fd5b853561520581615195565b9450602086013561521581615195565b9350604086013561522581615195565b9250606086013561523581615195565b9150608086013561524581615195565b809150509295509295909350565b60008060006060848603121561526857600080fd5b833561527381615195565b9250602084013561528381615195565b929592945050506040919091013590565b6000602082840312156152a657600080fd5b5035919050565b600080604083850312156152c057600080fd5b82356152cb81615195565b915060208301356152db81615195565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715615324576153246152e6565b604052919050565b60006001600160401b03821115615345576153456152e6565b5060051b60200190565b600082601f83011261536057600080fd5b813560206153756153708361532c565b6152fc565b82815260059290921b8401810191818101908684111561539457600080fd5b8286015b848110156153b85780356153ab81615195565b8352918301918301615398565b509695505050505050565b600080604083850312156153d657600080fd5b82356001600160401b03808211156153ed57600080fd5b6153f98683870161534f565b935060209150818501358181111561541057600080fd5b85019050601f8101861361542357600080fd5b80356154316153708261532c565b81815260059190911b8201830190838101908883111561545057600080fd5b928401925b8284101561546e57833582529284019290840190615455565b80955050505050509250929050565b600081518084526020808501945080840160005b838110156154b65781516001600160a01b031687529582019590820190600101615491565b509495945050505050565b6060815260006154d4606083018661547d565b82810360208401526154e6818661547d565b905082810360408401526154fa818561547d565b9695505050505050565b60006020828403121561551657600080fd5b81356001600160401b0381111561552c57600080fd5b614fe48482850161534f565b6000806040838503121561554b57600080fd5b823561555681615195565b946020939093013593505050565b600082601f83011261557557600080fd5b813560206155856153708361532c565b82815260059290921b840181019181810190868411156155a457600080fd5b8286015b848110156153b85780356001600160401b038111156155c75760008081fd5b6155d58986838b010161534f565b8452509183019183016155a8565b6000806000606084860312156155f857600080fd5b83356001600160401b038082111561560f57600080fd5b61561b8783880161534f565b9450602086013591508082111561563157600080fd5b5061563e86828701615564565b925050604084013590509250925092565b6000806040838503121561566257600080fd5b50508035926020909101359150565b60008083601f84011261568357600080fd5b5081356001600160401b0381111561569a57600080fd5b6020830191508360208260051b85010111156156b557600080fd5b9250929050565b6000806000806000606086880312156156d457600080fd5b8535945060208601356001600160401b03808211156156f257600080fd5b6156fe89838a01615671565b9096509450604088013591508082111561571757600080fd5b5061572488828901615671565b969995985093965092949392505050565b6020815260006151c7602083018461547d565b60008060006060848603121561575d57600080fd5b833561576881615195565b9250602084013561577881615195565b9150604084013561578881615195565b809150509250925092565b600080604083850312156157a657600080fd5b82356001600160401b03808211156157bd57600080fd5b6157c98683870161534f565b935060208501359150808211156157df57600080fd5b506157ec85828601615564565b9150509250929050565b6000806040838503121561580957600080fd5b8235915060208301356152db81615195565b60006020828403121561582d57600080fd5b81516151c781615195565b600b81526a2b27aa22a92fa0a226a4a760a91b602082015260400190565b60408152600061586860408301615838565b6001600160a01b0393909316602092909201919091525090565b60006020828403121561589457600080fd5b815180151581146151c757600080fd5b6020815260006158b660208301615838565b92915050565b602080825260059082015264061646472360dc1b604082015260600190565b602080825260049082015263199858dd60e21b604082015260600190565b60208082526005908201526419d19858dd60da1b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b6001600160a01b03929092168252602082015260400190565b6020808252600f908201526e10b0b8383937bb32b217a7bbb732b960891b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b6000821982111561599957615999615970565b500190565b6000600182016159b0576159b0615970565b5060010190565b6020808252600990820152680858dbdb9d1c9858dd60ba1b604082015260600190565b6000828210156159ec576159ec615970565b500390565b6000816000190483118215151615615a0b57615a0b615970565b500290565b600082615a2d57634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215615a4457600080fd5b5051919050565b600060608284031215615a5d57600080fd5b604051606081016001600160401b0381118282101715615a7f57615a7f6152e6565b80604052508251815260208301516020820152604083015160408201528091505092915050565b828152604060208201526000614fe4604083018461547d565b918252602082015260400190565b600a815269474f5645524e414e434560b01b602082015260400190565b60408152600061586860408301615acd565b6020815260006158b660208301615acd565b6020808252600690820152651ada5b1b195960d21b604082015260600190565b60208082526006908201526521676175676560d01b604082015260600190565b6001600160a01b0383168152604060208201819052600090614fe49083018461547d565b60008060408385031215615b8557600080fd5b505080516020909101519092909150565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6001600160a01b0392831681529116602082015260400190565b60005b83811015615c16578181015183820152602001615bfe565b8381111561202e5750506000910152565b600060208284031215615c3957600080fd5b81516001600160401b0380821115615c5057600080fd5b818401915084601f830112615c6457600080fd5b815181811115615c7657615c766152e6565b615c89601f8201601f19166020016152fc565b9150808252856020828501011115615ca057600080fd5b615cb1816020840160208601615bfb565b50949350505050565b6e029bbb0b82c102628102332b2b99d1608d1b815260008251615ce481600f850160208701615bfb565b91909101600f0192915050565b60008151808452615d09816020860160208601615bfb565b601f01601f19169290920160200192915050565b6001600160a01b0385811682528481166020830152831660408201526080606082018190526000906154fa90830184615cf1565b71029bbb0b82c1024b731b2b73a34bb32b99d160751b815260008251615d7e816012850160208701615bfb565b9190910160120192915050565b60008251615d9d818460208701615bfb565b9190910192915050565b6020815260006151c76020830184615cf156fe44da158ba27f9252712a74ff6a55c5d531f69609f1f6e7f17c4443a8e2089be4a1bb19b5d754d8c6479f7761797294f0786b22f6fe2fd51b0b81e56f4136cd93a01124614129d8b1fb8a4fd2f718422cb3d34c92ff59026e1fb316871a2b9c39af85b9071dfafeac1409d3f1d19bafc9bc7c37974cde8df0ee6168f0086e539cddf0ec8cba6dad18edc75774c452fa4201ff17ec1761486329f3321936ce66d0a2646970667358221220ea55034f0b58864efc3528d83a666574ec5cb41ef644e3fe516ff61a812d4fc264736f6c634300080d0033

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

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