Contract 0x45ada0c978d2dff136e56958d31489ede4af137a 10

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x509ff872822b97665a39b0feb9595df516f15220f48b3607f1f8bb69c0521aaeGet All Reward1537850652023-11-25 2:32:007 days 12 hrs ago0x4cdfdc71d50a3719db458ad1c641363af1b05f1b IN  0x45ada0c978d2dff136e56958d31489ede4af137a0 ETH0.00006609 0.1
0x8e543e7206eb22397ceca65c249ef599385fb7173c60f495114b54f491293198Withdraw And Har...1220884052023-08-16 23:13:20107 days 15 hrs ago0xbee2d469aacb46251ae33cca91f482e26c971dff IN  0x45ada0c978d2dff136e56958d31489ede4af137a0 ETH0.00012385 0.1
0x2649529afb92e310b05464207013df6945e93824f85a1468d6d9499d969fd89cGet All Reward1175880532023-08-03 1:47:07121 days 12 hrs ago0x0bd27fac898a59680b9dc92bb7378df610825e8d IN  0x45ada0c978d2dff136e56958d31489ede4af137a0 ETH0.00006466 0.1
0x54fa06bdcf094b54ae91bb3b5ba1356037ffb6785b3848a1db31a46ecf080943Get All Reward1175494032023-08-02 22:28:03121 days 16 hrs ago0xbee2d469aacb46251ae33cca91f482e26c971dff IN  0x45ada0c978d2dff136e56958d31489ede4af137a0 ETH0.00006296 0.1
0x824408434575f3df20eff78492c19cc814d6d8119794c084952c19889b187598Withdraw And Har...1159407362023-07-29 0:45:03126 days 13 hrs ago0xb87f639674bf7d185f55924a2f90dd0ea4741d7f IN  0x45ada0c978d2dff136e56958d31489ede4af137a0 ETH0.00006774 0.1
0xe58dd7e6acf1d0be106c2e11b033ba32acc5ba5674542fbd689fcb2161ef2cdfWithdraw And Har...1145500092023-07-24 18:42:49130 days 20 hrs ago0xaef799aec65d13f5c1cabc847ed1d894100f0ba9 IN  0x45ada0c978d2dff136e56958d31489ede4af137a0 ETH0.00010516 0.1
0x679f418c273481940e5f789ca1e32a0c2f45c38ce9246bd5a5b90a96b91727f9Get All Reward1145497302023-07-24 18:41:40130 days 20 hrs ago0xaef799aec65d13f5c1cabc847ed1d894100f0ba9 IN  0x45ada0c978d2dff136e56958d31489ede4af137a0 ETH0.00006991 0.1
0x7926669fd4253aa13d8cb034feee495b3e730f8bdde1188297c7a3557b5e3823Withdraw And Har...1127952942023-07-19 12:21:52136 days 2 hrs ago0x1e670bb5fec8d4cebddc3d2ad99d68f15210d742 IN  0x45ada0c978d2dff136e56958d31489ede4af137a0 ETH0.00006416 0.1
0xb6a8ff5efcd64d12e6244869dbd812913a75fbbf96e1e0953bd9402b61894e23Withdraw And Har...1127951182023-07-19 12:21:07136 days 2 hrs ago0x1e670bb5fec8d4cebddc3d2ad99d68f15210d742 IN  0x45ada0c978d2dff136e56958d31489ede4af137a0 ETH0.00006464 0.1
0xd66b3f5e5eede69c52816400184093eea0bfd9850e0796e2a39a9be525c59a9fWithdraw And Har...1127949002023-07-19 12:20:13136 days 2 hrs ago0x1e670bb5fec8d4cebddc3d2ad99d68f15210d742 IN  0x45ada0c978d2dff136e56958d31489ede4af137a0 ETH0.00006851 0.1
0xe420c221233504ebe80087e4ffab22c53cfa2d98c90b6682ef1b72832aabaf67Get All Reward1120601662023-07-17 7:32:52138 days 7 hrs ago0x3842f081d592ee512cd5a4556a64fc3bca666e8c IN  0x45ada0c978d2dff136e56958d31489ede4af137a0 ETH0.00008254 0.1
0xf930ad8cba1c60dfe92e883dd402704d5abce0ff0f74bc7b19c6aa4ab0439143Withdraw And Har...1120597282023-07-17 7:31:02138 days 7 hrs ago0x3842f081d592ee512cd5a4556a64fc3bca666e8c IN  0x45ada0c978d2dff136e56958d31489ede4af137a0 ETH0.00006176 0.1
0xa9c98ce3f8dde706375e912136006c9d8fce5f32360455242ccc2ab608132bbeWithdraw And Har...1118941012023-07-16 19:33:40138 days 19 hrs ago0x16a4ec779ec71f9019ff79cbdd082a078c9ea06a IN  0x45ada0c978d2dff136e56958d31489ede4af137a0 ETH0.00006303 0.1
0x1c360e488d205d1d21061e5eff1527786304f03672b0302f9a0a72e0b9957299Get All Reward1118928242023-07-16 19:28:11138 days 19 hrs ago0x16a4ec779ec71f9019ff79cbdd082a078c9ea06a IN  0x45ada0c978d2dff136e56958d31489ede4af137a0 ETH0.00004406 0.1
0x6a0ba6b5587c6a9479435dee1a62d59fb8ce8ffbda6a3f747cd11d5ab965934bGet All Reward1113888102023-07-15 7:22:21140 days 7 hrs ago0x0bd27fac898a59680b9dc92bb7378df610825e8d IN  0x45ada0c978d2dff136e56958d31489ede4af137a0 ETH0.00005406 0.1
0x05fef462e28b22f1c665930e0041215c063fae3d17cfdabf716a089c83bffc00Get All Reward1110234872023-07-14 5:36:15141 days 9 hrs ago0x3842f081d592ee512cd5a4556a64fc3bca666e8c IN  0x45ada0c978d2dff136e56958d31489ede4af137a0 ETH0.00009368 0.1
0x389c78914764b08e102cb1844e0c7161fd2b308bd4cbd9abccb20269deed87dcGet All Reward1105225392023-07-12 17:44:59142 days 20 hrs ago0x1e670bb5fec8d4cebddc3d2ad99d68f15210d742 IN  0x45ada0c978d2dff136e56958d31489ede4af137a0 ETH0.00014289 0.1
0xe32b6e5b0beb07932ce4b53d7f2e860dfc4652357f7eb26bc7bd3a14854b8e8eWithdraw And Har...1098123532023-07-10 15:05:25144 days 23 hrs ago0x139a46f02afe508ad5daa731d5021edbedb717b8 IN  0x45ada0c978d2dff136e56958d31489ede4af137a0 ETH0.00009088 0.1
0x2e5ca9a3ec922dff310168c3ed9b82b5a71df596f9c873c0c57c797f312127aaGet All Reward1094035812023-07-09 10:03:20146 days 4 hrs ago0x4334703b0b74e2045926f82f4158a103fce1df4f IN  0x45ada0c978d2dff136e56958d31489ede4af137a0 ETH0.00002369 0.1
0x8e3c423cb0dc63259242663c05600991d9cdd030b47a5f5ff6c9f93765379447Withdraw And Har...1094024722023-07-09 9:58:45146 days 4 hrs ago0x4334703b0b74e2045926f82f4158a103fce1df4f IN  0x45ada0c978d2dff136e56958d31489ede4af137a0 ETH0.0000608 0.1
0xb77e4dac2c3da9237de711073ebaee10bc16cadc118a6bcc48864a3661d26195Withdraw And Har...1094024162023-07-09 9:58:31146 days 4 hrs ago0x4334703b0b74e2045926f82f4158a103fce1df4f IN  0x45ada0c978d2dff136e56958d31489ede4af137a0 ETH0.0000608 0.1
0xdc18138b49f1ed8fdfe7edb63fc59a7b9463d75087a88003b10e5e898178a005Withdraw And Har...1094022892023-07-09 9:57:48146 days 4 hrs ago0x4334703b0b74e2045926f82f4158a103fce1df4f IN  0x45ada0c978d2dff136e56958d31489ede4af137a0 ETH0.0000608 0.1
0x9a054b14b60a19a18e5f2f9ac6d5fe068f2984cc76dc307170729096945e9b29Withdraw And Har...1094021282023-07-09 9:57:08146 days 4 hrs ago0x4334703b0b74e2045926f82f4158a103fce1df4f IN  0x45ada0c978d2dff136e56958d31489ede4af137a0 ETH0.0000608 0.1
0x09de16c5565c3df1b8236435f1a1b7ed4901a247b5d47731b0773ebff2e67c0fWithdraw And Har...1094020522023-07-09 9:56:51146 days 4 hrs ago0x4334703b0b74e2045926f82f4158a103fce1df4f IN  0x45ada0c978d2dff136e56958d31489ede4af137a0 ETH0.00006224 0.1
0x2dcb7393352afae6fc1731663f58b6b1e8f22e6797d031adf7f6b51acf8513abDeposit1082799912023-07-06 0:50:23149 days 13 hrs ago0x1e670bb5fec8d4cebddc3d2ad99d68f15210d742 IN  0x45ada0c978d2dff136e56958d31489ede4af137a0 ETH0.0001185 0.1
[ Download CSV Export 
Latest 1 internal transaction
Parent Txn Hash Block From To Value
0x999b616537c13e0fd2898ed0b6158965e522ccb022f1f0ad8964db7c11d30f1c923459352023-05-19 17:34:17196 days 21 hrs ago 0x24917af386e2fcf1aa1994fd3949f080740aeb23  Contract Creation0 ETH
[ Download CSV Export 
Loading

Similar Match Source Code
This contract matches the deployed ByteCode of the Source Code for Contract 0xF319285fa8b5323A40c71D3c006dBd0BE4f5171b
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
MaGauge

Compiler Version
v0.8.13+commit.abaa5c0e

Optimization Enabled:
Yes with 10 runs

Other Settings:
default evmVersion
File 1 of 13 : MaGauge.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;


import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

import './interfaces/IPair.sol';
import './interfaces/IBribe.sol';
import './interfaces/IMaLPNFT.sol';
import "./libraries/Math.sol";

interface IRewarder {
    function onReward(
        uint256 pid,
        address user,
        address recipient,
        uint256 amount,
        uint256 newLpAmount
    ) external;
}


contract MaGauge is ReentrancyGuard, Ownable {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

    struct PositionInfo {
        uint amount;
        uint rewardDebt;
        uint rewardCredit;
        uint entry; // position owner's relative entry into the pool.
        uint poolId; // ensures that a single Relic is only used for one pool.
        uint level;
    }  

    bool public isForPair;


    IERC20 public rewardToken;
    IERC20 public _VE;
    IERC20 public TOKEN;

    address public DISTRIBUTION;
    address public internal_bribe;
    address public external_bribe;
    address public maNFTs;

    uint256 public DURATION;
    uint256 public periodFinish;
    uint256 public rewardRate;
    uint256 public lastUpdateTime;
    uint256 public rewardPerTokenStored;
    uint public maGaugeId;

    uint public fees0;
    uint public fees1;

    mapping(uint => uint256) public userRewardPerTokenPaid;
    mapping(uint => uint256) public rewards;

    uint256 public _totalSupply;
    mapping(uint => uint256) public _balances;
    mapping(uint => uint256) public _depositEpoch;
    mapping(uint => uint256) public _start;
    uint nextEpoch;

    event RewardAdded(uint256 reward);
    event Deposit(address indexed user, uint tokenId, uint256 amount);
    event Withdraw(address indexed user, uint tokenId, uint256 amount);
    event Harvest(address indexed user, uint tokenId, uint256 reward);
    event ClaimFees(address indexed from, uint claimed0, uint claimed1);
    event Merged(uint from, uint to);
    event Splited(uint from,address _to,  uint[] amounts);


    uint WEEK;
    uint[16] balancesByEpoch;
    uint PRECISION = 1000;


    function updateReward(uint _tokenId) public {
        adjustWeights();
        rewardPerTokenStored = rewardPerToken();
        lastUpdateTime = lastTimeRewardApplicable();
        if (_tokenId != 0) {
            rewards[_tokenId] = earned(_tokenId);
            userRewardPerTokenPaid[_tokenId] = rewardPerTokenStored;
        }
    }


    function adjustWeights() public {

        if( block.timestamp >= nextEpoch) {
            
            uint nextValue;
            uint _nextValue;
            for(uint i = 0; i < balancesByEpoch.length-1; i++) {
                _nextValue = balancesByEpoch[i];
                balancesByEpoch[i] = nextValue;
                nextValue = _nextValue;
            }
            balancesByEpoch[balancesByEpoch.length-1] = balancesByEpoch[balancesByEpoch.length-1] + nextValue;

            nextEpoch = nextEpoch + WEEK;
        }
    }

    modifier onlyDistribution() {
        require(msg.sender == DISTRIBUTION, "Caller is not RewardsDistribution contract");
        _;
    }



    constructor(address _rewardToken,address _ve,address _token,address _distribution, address _internal_bribe, address _external_bribe, bool _isForPair, address _maNFTs, uint _maGaugeId) {
        rewardToken = IERC20(_rewardToken);     // main reward
        _VE = IERC20(_ve);                      // vested
        TOKEN = IERC20(_token);                 // underlying (LP)
        DISTRIBUTION = _distribution;           // distro address (voter)
        DURATION = 7 * 86400;  
        WEEK = 7 * 86400;                   // week
        
        nextEpoch = ((block.timestamp/WEEK)+1) * WEEK;
        maGaugeId = _maGaugeId;
        maNFTs = _maNFTs;

        internal_bribe = _internal_bribe;       // lp fees goes here
        external_bribe = _external_bribe;       // bribe fees goes here

        isForPair = _isForPair;                       // pair boolean, if false no claim_fees

    }

    ///@notice set distribution address (should be GaugeProxyL2)
    function setDistribution(address _distribution) external onlyOwner {
        require(_distribution != address(0), "zero addr");
        require(_distribution != DISTRIBUTION, "same addr");
        DISTRIBUTION = _distribution;
    }


    ///@notice total supply held
    function totalSupply() public view returns (uint256) {
        return _totalSupply;
    }

    ///@notice total weight of matured liquidity provided
    function totalWeight() public view returns (uint256 _totalWeight) {
        uint[] memory weightsAmount = IMaLPNFT(maNFTs).getWeightByEpoch();
        uint _weightAmount;

        for(uint i = 0; i < balancesByEpoch.length; i++) {
            if (i < weightsAmount.length) {
                _weightAmount = weightsAmount[i];
            }
            _totalWeight = _totalWeight + (balancesByEpoch[i]*_weightAmount/PRECISION);
        }
    }

    ///@notice balance of a position
    function balanceOfToken(uint tokenId) public view returns (uint256) {
        return _balances[tokenId];
    }

        ///@notice balance of a position
    function balanceOf(address _user) external view returns (uint256) {
        uint _totalBalance;
        uint[] memory _tokenIds = IMaLPNFT(maNFTs).maGaugeTokensOfOwner(_user, address(this));
        for (uint i; i < _tokenIds.length; i++){
            _totalBalance += balanceOfToken(_tokenIds[i]);
        }
        return _totalBalance;
    }

    ///@notice weight of a position
    function weightOfToken(uint _tokenId) public view returns (uint256) {
        uint _balance = _balances[_tokenId];
        uint _matLevel = maturityLevelOfTokenMaxBoost( _tokenId );
        uint[] memory weightsAmount = IMaLPNFT(maNFTs).getWeightByEpoch();
        uint _weight = _balance*weightsAmount[_matLevel]/PRECISION;
        return _weight;
    }

    
    ///@notice total weight of a user
    function weightOfUser(address _user ) public view returns (uint256) {
        uint _totalWeight;
        uint[] memory _tokenIds = IMaLPNFT(maNFTs).maGaugeTokensOfOwner(_user, address(this));
        for (uint i; i < _tokenIds.length; i++){
            _totalWeight += weightOfToken(_tokenIds[i]);
        }
        return _totalWeight;
    }

    function maturityLevelOfTokenMaxBoost(uint _tokenId) public view returns (uint _matLevel) {
        _matLevel = (block.timestamp/WEEK) - _depositEpoch[_tokenId];
        uint _maxLevel = IMaLPNFT(maNFTs).totalMaLevels()-1;
        if (_maxLevel < _matLevel) {
            return _maxLevel;
        }
    }

    function maturityLevelOfTokenMaxArray(uint _tokenId) public view returns (uint _matLevel) {
        _matLevel = (block.timestamp/WEEK) - _depositEpoch[_tokenId];
        uint _maxMat = balancesByEpoch.length-1;
        if (_maxMat < _matLevel) {
            return _maxMat;
        }
    }

    ///@notice last time reward
    function lastTimeRewardApplicable() public view returns (uint256) {
        return Math.min(block.timestamp, periodFinish);
    }

    ///@notice  reward for a single token
    function rewardPerToken() public view returns (uint256) {
        if (totalWeight() == 0) {
            return rewardPerTokenStored;
        } else {
            return rewardPerTokenStored.add(lastTimeRewardApplicable().sub(lastUpdateTime).mul(rewardRate).mul(1e18).div(totalWeight()));
        }
    }

    ///@notice see earned rewards for a _tokenId
    function earned(uint _tokenId) public view returns (uint256) {
        return weightOfToken(_tokenId).mul(rewardPerToken().sub(userRewardPerTokenPaid[_tokenId])).div(1e18).add(rewards[_tokenId]);
    }

    ///@notice see earned rewards for user
    function earned(address _user) public view returns (uint256) {
        uint _totalEarned;
        uint[] memory _tokenIds = IMaLPNFT(maNFTs).maGaugeTokensOfOwner(_user, address(this));
        for (uint i; i < _tokenIds.length; i++){
            _totalEarned += weightOfToken(_tokenIds[i]).mul(rewardPerToken().sub(userRewardPerTokenPaid[_tokenIds[i]])).div(1e18).add(rewards[_tokenIds[i]]);
        }
        return _totalEarned;
    }


    ///@notice get total reward for the duration
    function rewardForDuration() external view returns (uint256) {
        return rewardRate * DURATION;
    }


    ///@notice deposit all TOKEN of msg.sender
    function depositAll() external returns(uint _tokenId) {
        _tokenId = _deposit(TOKEN.balanceOf(msg.sender), msg.sender);
    }

    ///@notice deposit amount TOKEN
    function deposit(uint256 amount) external returns(uint _tokenId) {
        _tokenId = _deposit(amount, msg.sender);
    }
        ///@notice deposit amount TOKEN to address _to
    function depositTo(uint256 amount, address _to) external returns(uint _tokenId) {
        require(_to != address(0),"invalid address");
        _tokenId = _deposit(amount, _to);
    }

    ///@notice deposit internal
    function _deposit(uint256 amount, address account) internal nonReentrant returns(uint _tokenId) {
        require(amount > 0, "deposit(Gauge): cannot stake 0");

        _tokenId = IMaLPNFT(maNFTs).mint(account);
        updateReward(_tokenId);

        _balances[_tokenId] = _balances[_tokenId].add(amount);
        _depositEpoch[_tokenId] = (block.timestamp/WEEK);

        balancesByEpoch[0] = balancesByEpoch[0] + amount;
        
        _totalSupply = _totalSupply + amount;

        TOKEN.safeTransferFrom(msg.sender, address(this), amount);

        emit Deposit(account, _tokenId, amount);
    }


    ///@notice withdraw internal
    function _withdraw(uint256 _tokenId) internal nonReentrant {
        require(IMaLPNFT(maNFTs).isApprovedOrOwner(msg.sender,_tokenId));
        require(IMaLPNFT(maNFTs).fromThisGauge(_tokenId));

        updateReward(_tokenId);
        uint amount = _balances[_tokenId];
        require(_tokenId > 0, "token Must Exist");
        require(amount > 0, "token Must Exist");
        require(_totalSupply.sub(amount) >= 0, "supply < 0");


        _totalSupply = _totalSupply.sub(amount);
        uint level = maturityLevelOfTokenMaxArray(_tokenId);
        balancesByEpoch[level] = balancesByEpoch[level] - amount;
        
        _balances[_tokenId] = _balances[_tokenId].sub(amount);
        _depositEpoch[_tokenId] = 0;

        IMaLPNFT(maNFTs).burn(_tokenId);

        TOKEN.safeTransfer(msg.sender, amount);

        emit Withdraw(msg.sender, _tokenId, amount);
    }


    ///@notice withdraw TOKEN and harvest rewardToken
    function withdrawAndHarvest(uint _tokenId) external {
        getReward(_tokenId);
        _withdraw(_tokenId);
    }

    function withdrawAndHarvestAll() external {
        uint256[] memory _tokenIds = IMaLPNFT(maNFTs).maGaugeTokensOfOwner(msg.sender,address(this));

        for (uint256 i; i < _tokenIds.length; i++) {
            getReward(_tokenIds[i]);
            _withdraw(_tokenIds[i]);
        }
    }
    

    function getAllReward() external {
        uint256[] memory _tokenIds = IMaLPNFT(maNFTs).maGaugeTokensOfOwner(msg.sender,address(this));

        for (uint256 i; i < _tokenIds.length; i++) {
            getReward(_tokenIds[i]);
        }
    }


    function harvestAndMerge(uint _from, uint _to) external  {
        require(_from != _to);
        require ( _depositEpoch[_from] == _depositEpoch[_to], "Maturity level should be the same in both maNFTs");
        
        getReward(_from);  //those functions ensure its from msg.sender and they are from this gauge
        getReward(_to);

        _balances[_to] += _balances[_from];
        _balances[_from] = 0;

        _depositEpoch[_from] = 0;

        IMaLPNFT(maNFTs).burn(_from);

        emit Merged( _from, _to);
    }
    
    
    function harvestAndSplit(uint[] memory amounts, uint _tokenId) external  {
        
        getReward(_tokenId);  //those functions ensure its from msg.sender and they are from this gauge


        uint value = _balances[_tokenId];
        uint __depositEpoch = _depositEpoch[_tokenId];

        address _to = IMaLPNFT(maNFTs).ownerOf(_tokenId);

        uint i;
        uint _totalWeight = 0;
        for(i = 0; i < amounts.length; i++){
            _totalWeight += amounts[i];
        }

        uint _value = 0;
        for(i = 0; i < amounts.length; i++){   

            uint __tokenId = IMaLPNFT(maNFTs).mint(_to);
            updateReward(__tokenId);
            _value = value * amounts[i] / _totalWeight;
            _depositEpoch[__tokenId] = __depositEpoch;
            _balances[__tokenId] = _value;
        }

        _balances[_tokenId] = 0;
        _depositEpoch[_tokenId] = 0;
        IMaLPNFT(maNFTs).burn(_tokenId);

        emit Splited( _tokenId, _to, amounts);
    }

    
    ///@notice User harvest function
    function getReward(uint _tokenId) public nonReentrant {
        require(IMaLPNFT(maNFTs).isApprovedOrOwner(msg.sender,_tokenId));
        require(IMaLPNFT(maNFTs).fromThisGauge(_tokenId));
        updateReward(_tokenId);
        uint256 reward = rewards[_tokenId];
        if (reward > 0) {
            rewards[_tokenId] = 0;
            rewardToken.safeTransfer(msg.sender, reward);
            emit Harvest(msg.sender, _tokenId, reward);
        }


    }

    function _periodFinish() external view returns (uint256) {
        return periodFinish;
    }

    /// @dev Receive rewards from distribution
    function notifyRewardAmount(address token, uint reward) external nonReentrant onlyDistribution {
        updateReward(0);
        require(token == address(rewardToken));
        rewardToken.safeTransferFrom(DISTRIBUTION, address(this), reward);

        if (block.timestamp >= periodFinish) {
            rewardRate = reward.div(DURATION);
        } else {
            uint256 remaining = periodFinish.sub(block.timestamp);
            uint256 leftover = remaining.mul(rewardRate);
            rewardRate = reward.add(leftover).div(DURATION);
        }

        // Ensure the provided reward amount is not more than the balance in the contract.
        // This keeps the reward rate in the right range, preventing overflows due to
        // very high values of rewardRate in the earned and rewardsPerToken functions;
        // Reward + leftover must be less than 2^256 / 10^18 to avoid overflow.
        uint256 balance = rewardToken.balanceOf(address(this));
        require(rewardRate <= balance.div(DURATION), "Provided reward too high");

        lastUpdateTime = block.timestamp;
        periodFinish = block.timestamp.add(DURATION);
        emit RewardAdded(reward);
    }

    function claimFees() external nonReentrant returns (uint claimed0, uint claimed1) {
        return _claimFees();
    }

    function _claimFees() internal returns (uint claimed0, uint claimed1) {
        if (!isForPair) {
            return (0, 0);
        }
        address _token = address(TOKEN);

        (claimed0, claimed1) = IPair(_token).claimFees();

        if (claimed0 > 0 || claimed1 > 0) {
            uint _fees0 = fees0 + claimed0;
            uint _fees1 = fees1 + claimed1;
            (address _token0, address _token1) = IPair(_token).tokens();

            if (_fees0  > 0) {
                fees0 = 0;
                IERC20(_token0).approve(internal_bribe, _fees0);
                IBribe(internal_bribe).notifyRewardAmount(_token0, _fees0);
            } else {
                fees0 = _fees0;
            }


            if (_fees1  > 0) {
                fees1 = 0;
                IERC20(_token1).approve(internal_bribe, _fees1);
                IBribe(internal_bribe).notifyRewardAmount(_token1, _fees1);
            } else {
                fees1 = _fees1;
            }


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



}

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

interface IPair {
    function metadata() external view returns (uint dec0, uint dec1, uint r0, uint r1, bool st, address t0, address t1);
    function claimFees() external returns (uint, uint);
    function tokens() external view returns (address, address);
    function transferFrom(address src, address dst, uint amount) external returns (bool);
    function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
    function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
    function burn(address to) external returns (uint amount0, uint amount1);
    function mint(address to) external returns (uint liquidity);
    function getReserves() external view returns (uint _reserve0, uint _reserve1, uint _blockTimestampLast);
    function getAmountOut(uint, address) external view returns (uint);

    function name() external view returns(string memory);
    function symbol() external view returns(string memory);
    function totalSupply() external view returns (uint);
    function decimals() external view returns (uint8);

    function claimable0(address _user) external view returns (uint);
    function claimable1(address _user) external view returns (uint);

    function isStable() external view returns(bool);
    function sync() external;


    /*function token0() external view returns(address);
    function reserve0() external view returns(address);
    function decimals0() external view returns(address);
    function token1() external view returns(address);
    function reserve1() external view returns(address);
    function decimals1() external view returns(address);*/


}

File 3 of 13 : 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 notifyRewardAmount(address token, uint amount) external;
    function left(address token) external view returns (uint);
}

File 4 of 13 : 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;
    }}
}

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

interface IMaLPNFT {
  

  function addGauge ( address _maGaugeAddress, address _pool, address _token0, address _token1, uint _maGaugeId ) external;
  function approve ( address _approved, uint256 _tokenId ) external;
  function artProxy (  ) external view returns ( address );
  function balanceOf ( address _owner ) external view returns ( uint256 );
  function burn ( uint256 _tokenId ) external;
  function getApproved ( uint256 _tokenId ) external view returns ( address );
  function initialize ( address art_proxy ) external;
  function isApprovedForAll ( address _owner, address _operator ) external view returns ( bool );
  function isApprovedOrOwner ( address _spender, uint256 _tokenId ) external view returns ( bool );
  function killGauge ( address _gauge ) external;
  function maGauges ( address ) external view returns (
    bool active,
    bool stablePair,
    address pair,
    address token0,
    address token1,
    address maGaugeAddress,
    string memory name,
    string memory symbol,
    uint maGaugeId
  );
  function mint ( address _to ) external returns ( uint256 _tokenId );
  function ms (  ) external view returns ( address );
  function name (  ) external view returns ( string memory );
  function ownerOf ( uint256 _tokenId ) external view returns ( address );
  function ownership_change ( uint256 ) external view returns ( uint256 );
  function reset (  ) external;
  function reviveGauge ( address _gauge ) external;
  function maGaugeTokensOfOwner(address _owner, address _gauge) external view returns (uint256[] memory);
  function fromThisGauge(uint _tokenId) external view returns(bool);
  function safeTransferFrom ( address _from, address _to, uint256 _tokenId ) external;
  function safeTransferFrom ( address _from, address _to, uint256 _tokenId, bytes memory _data  ) external;
  function setApprovalForAll ( address _operator, bool _approved ) external;
  function setArtProxy ( address _proxy ) external;
  function setBoostParams ( uint256 _maxBonusEpoch, uint256 _maxBonusPercent ) external;
  function setTeam ( address _team ) external;
  function supportsInterface ( bytes4 _interfaceID ) external view returns ( bool );
  function symbol (  ) external view returns ( string memory );
  function team (  ) external view returns ( address );
  function getWeightByEpoch() external view returns (uint[] memory weightsByEpochs);
  function totalMaLevels() external view returns (uint _totalMaLevels);
  function tokenOfOwnerByIndex ( address _owner, uint256 _tokenIndex ) external view returns ( uint256 );
  function tokenToGauge ( uint256 ) external view returns ( address );
  function tokenURI ( uint256 _tokenId ) external view returns ( string memory );
  function transferFrom ( address _from, address _to, uint256 _tokenId ) external;
  function version (  ) external view returns ( string memory );
  function voter (  ) external view returns ( address );
}

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

pragma solidity ^0.8.0;

import "../utils/Context.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 Ownable is Context {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _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);
    }
}

File 7 of 13 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

File 8 of 13 : IERC20.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 IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

    /**
     * @dev Returns the 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 9 of 13 : SafeMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol)

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

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

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

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

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

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

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

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

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

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

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

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

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

File 10 of 13 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";

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

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

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

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

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

    function safeDecreaseAllowance(
        IERC20 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(
        IERC20Permit 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(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

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

File 11 of 13 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

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

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

File 12 of 13 : draft-IERC20Permit.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 IERC20Permit {
    /**
     * @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 13 of 13 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [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 functionCall(target, data, "Address: low-level call failed");
    }

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

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

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

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

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

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

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

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason 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 {
            // 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);
            }
        }
    }
}

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

Contract ABI

[{"inputs":[{"internalType":"address","name":"_rewardToken","type":"address"},{"internalType":"address","name":"_ve","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_distribution","type":"address"},{"internalType":"address","name":"_internal_bribe","type":"address"},{"internalType":"address","name":"_external_bribe","type":"address"},{"internalType":"bool","name":"_isForPair","type":"bool"},{"internalType":"address","name":"_maNFTs","type":"address"},{"internalType":"uint256","name":"_maGaugeId","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"claimed0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"claimed1","type":"uint256"}],"name":"ClaimFees","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"Harvest","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"from","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"to","type":"uint256"}],"name":"Merged","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":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"RewardAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"from","type":"uint256"},{"indexed":false,"internalType":"address","name":"_to","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"Splited","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"DISTRIBUTION","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TOKEN","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_VE","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"_balances","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"_depositEpoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_periodFinish","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"_start","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"adjustWeights","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"balanceOfToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimFees","outputs":[{"internalType":"uint256","name":"claimed0","type":"uint256"},{"internalType":"uint256","name":"claimed1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"depositAll","outputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"_to","type":"address"}],"name":"depositTo","outputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"earned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"earned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"external_bribe","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fees0","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fees1","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_from","type":"uint256"},{"internalType":"uint256","name":"_to","type":"uint256"}],"name":"harvestAndMerge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"harvestAndSplit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"internal_bribe","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isForPair","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastTimeRewardApplicable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastUpdateTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maGaugeId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maNFTs","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"maturityLevelOfTokenMaxArray","outputs":[{"internalType":"uint256","name":"_matLevel","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"maturityLevelOfTokenMaxBoost","outputs":[{"internalType":"uint256","name":"_matLevel","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"reward","type":"uint256"}],"name":"notifyRewardAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"periodFinish","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardForDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardPerToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardPerTokenStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_distribution","type":"address"}],"name":"setDistribution","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalWeight","outputs":[{"internalType":"uint256","name":"_totalWeight","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"}],"name":"updateReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"userRewardPerTokenPaid","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"weightOfToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"weightOfUser","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"withdrawAndHarvest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawAndHarvestAll","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040526103e86029553480156200001757600080fd5b5060405162002e3938038062002e398339810160408190526200003a91620001a3565b60016000556200004a3362000134565b600280546001600160a01b03808c166001600160a01b031992831617909255600380548b8416908316179055600480548a8416908316179055600580549289169290911691909117905562093a8060098190556018819055620000ae814262000271565b620000bb90600162000294565b620000c79190620002af565b601755600e55600880546001600160a01b03199081166001600160a01b039384161790915560068054821695831695909517909455600780549094169216919091179091556001805460ff60a01b1916600160a01b9215159290920291909117905550620002d192505050565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b80516001600160a01b03811681146200019e57600080fd5b919050565b60008060008060008060008060006101208a8c031215620001c357600080fd5b620001ce8a62000186565b9850620001de60208b0162000186565b9750620001ee60408b0162000186565b9650620001fe60608b0162000186565b95506200020e60808b0162000186565b94506200021e60a08b0162000186565b935060c08a015180151581146200023457600080fd5b92506200024460e08b0162000186565b91506101008a015190509295985092959850929598565b634e487b7160e01b600052601160045260246000fd5b6000826200028f57634e487b7160e01b600052601260045260246000fd5b500490565b60008219821115620002aa57620002aa6200025b565b500190565b6000816000190483118215151615620002cc57620002cc6200025b565b500290565b612b5880620002e16000396000f3fe608060405234801561001057600080fd5b50600436106102665760003560e01c80628cc2621461026b57806303fbf83a14610291578063059822f6146102b15780630914e011146102c45780631407c664146102ce57806318160ddd146102d65780631be05289146102de5780631c4b774b146102e7578063327d177d146102fa57806337fbe02b1461030d5780633d24a36b146103205780633eaaf86b14610340578063425c8abd146103495780634c02a21c1461035c5780634d6ed8c414610365578063617a8d9e146103785780636946a2351461038b5780636c6f858b1461039357806370a08231146103b357806370aff70f146103c6578063715018a6146103d957806373503857146103e1578063770f8571146103e95780637b0a47ee146103fc5780637c91e4eb146104055780637f699015146104185780637f784f2c1461042b57806380faa57d1461044b57806382bfefc81461045357806384fd70cc146104665780638b7ec4b4146104795780638c715407146104995780638da5cb5b146104ac57806393712f1e146104b457806393f1c442146104c757806396c82e57146104d05780639f6d7d5b146104d8578063a4ce79e1146104eb578063a7cb4192146104fe578063b66503cf14610506578063b6b55f2514610519578063bd09ead21461052c578063c8f33c9114610535578063cd3daf9d1461053e578063d294f09314610546578063de5f62681461055c578063df136d6514610564578063e57482131461056d578063ebe2b12b14610591578063efd326921461059a578063f2fde38b146105ba578063f301af42146105cd578063f7c618c1146105ed575b600080fd5b61027e6102793660046125f5565b610600565b6040519081526020015b60405180910390f35b6007546102a4906001600160a01b031681565b6040516102889190612612565b61027e6102bf366004612626565b610762565b6102cc6107ae565b005b600a5461027e565b60135461027e565b61027e60095481565b6102cc6102f5366004612626565b61086c565b61027e610308366004612626565b610a1f565b6102cc61031b366004612626565b610acc565b61027e61032e366004612626565b60146020526000908152604090205481565b61027e60135481565b6102cc610357366004612626565b610ae1565b61027e60105481565b61027e610373366004612626565b610b30565b6008546102a4906001600160a01b031681565b61027e610b7c565b61027e6103a1366004612626565b60116020526000908152604090205481565b61027e6103c13660046125f5565b610b93565b61027e6103d436600461263f565b610c6a565b6102cc610cc5565b6102cc610cd9565b6006546102a4906001600160a01b031681565b61027e600b5481565b6005546102a4906001600160a01b031681565b6102cc6104263660046125f5565b610da8565b61027e610439366004612626565b60156020526000908152604090205481565b61027e610e5e565b6004546102a4906001600160a01b031681565b61027e6104743660046125f5565b610e6c565b61027e610487366004612626565b60166020526000908152604090205481565b61027e6104a7366004612626565b610f29565b6102a4611001565b6102cc6104c23660046126d8565b611010565b61027e600f5481565b61027e61129f565b6003546102a4906001600160a01b031681565b6102cc6104f9366004612773565b6113a3565b6102cc611523565b6102cc610514366004612795565b6115ec565b61027e610527366004612626565b61184c565b61027e600e5481565b61027e600c5481565b61027e611858565b61054e6118a7565b6040516102889291906127c1565b61027e6118e6565b61027e600d5481565b60015461058190600160a01b900460ff1681565b6040519015158152602001610288565b61027e600a5481565b61027e6105a8366004612626565b60009081526014602052604090205490565b6102cc6105c83660046125f5565b611961565b61027e6105db366004612626565b60126020526000908152604090205481565b6002546102a4906001600160a01b031681565b600854604051631eedca4760e01b8152600091829182916001600160a01b031690631eedca479061063790879030906004016127cf565b600060405180830381865afa158015610654573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261067c91908101906127e9565b905060005b81518110156107595761073b601260008484815181106106a3576106a361286e565b6020026020010151815260200190815260200160002054610735670de0b6b3a764000061072f610707601160008989815181106106e2576106e261286e565b6020026020010151815260200190815260200160002054610701611858565b906119d7565b61072988888151811061071c5761071c61286e565b6020026020010151610f29565b906119e3565b906119ef565b906119fb565b610745908461289a565b925080610751816128b2565b915050610681565b50909392505050565b60008181526015602052604081205460185461077e90426128cb565b61078891906128ed565b90506000610798600160106128ed565b9050818110156107a85792915050565b50919050565b600854604051631eedca4760e01b81526000916001600160a01b031690631eedca47906107e190339030906004016127cf565b600060405180830381865afa1580156107fe573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261082691908101906127e9565b905060005b8151811015610868576108568282815181106108495761084961286e565b602002602001015161086c565b80610860816128b2565b91505061082b565b5050565b6002600054036108975760405162461bcd60e51b815260040161088e90612904565b60405180910390fd5b600260005560085460405163430c208160e01b81526001600160a01b039091169063430c2081906108ce903390859060040161293b565b602060405180830381865afa1580156108eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090f9190612954565b61091857600080fd5b6008546040516305ff561360e51b8152600481018390526001600160a01b039091169063bfeac26090602401602060405180830381865afa158015610961573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109859190612954565b61098e57600080fd5b61099781610ae1565b6000818152601260205260409020548015610a16576000828152601260205260408120556002546109d2906001600160a01b03163383611a07565b336001600160a01b03167f71bab65ced2e5750775a0613be067df48ef06cf92a496ebf7663ae06609249548383604051610a0d9291906127c1565b60405180910390a25b50506001600055565b600081815260156020526040812054601854610a3b90426128cb565b610a4591906128ed565b905060006001600860009054906101000a90046001600160a01b03166001600160a01b03166319a2c8ac6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ac29190612976565b61079891906128ed565b610ad58161086c565b610ade81611a62565b50565b610ae9611523565b610af1611858565b600d55610afc610e5e565b600c558015610ade57610b0e81610b30565b600091825260126020908152604080842092909255600d546011909152912055565b6000818152601260209081526040808320546011909252822054610b76919061073590670de0b6b3a76400009061072f90610b6d90610701611858565b61072988610f29565b92915050565b6000600954600b54610b8e919061298f565b905090565b600854604051631eedca4760e01b8152600091829182916001600160a01b031690631eedca4790610bca90879030906004016127cf565b600060405180830381865afa158015610be7573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c0f91908101906127e9565b905060005b815181101561075957610c4c828281518110610c3257610c3261286e565b602002602001015160009081526014602052604090205490565b610c56908461289a565b925080610c62816128b2565b915050610c14565b60006001600160a01b038216610cb45760405162461bcd60e51b815260206004820152600f60248201526e696e76616c6964206164647265737360881b604482015260640161088e565b610cbe8383611d65565b9392505050565b610ccd611f25565b610cd76000611f84565b565b600854604051631eedca4760e01b81526000916001600160a01b031690631eedca4790610d0c90339030906004016127cf565b600060405180830381865afa158015610d29573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610d5191908101906127e9565b905060005b815181101561086857610d748282815181106108495761084961286e565b610d96828281518110610d8957610d8961286e565b6020026020010151611a62565b80610da0816128b2565b915050610d56565b610db0611f25565b6001600160a01b038116610df25760405162461bcd60e51b81526020600482015260096024820152683d32b9379030b2323960b91b604482015260640161088e565b6005546001600160a01b0390811690821603610e3c5760405162461bcd60e51b815260206004820152600960248201526839b0b6b29030b2323960b91b604482015260640161088e565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b6000610b8e42600a54611fd6565b600854604051631eedca4760e01b8152600091829182916001600160a01b031690631eedca4790610ea390879030906004016127cf565b600060405180830381865afa158015610ec0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610ee891908101906127e9565b905060005b815181101561075957610f0b82828151811061071c5761071c61286e565b610f15908461289a565b925080610f21816128b2565b915050610eed565b60008181526014602052604081205481610f4284610a1f565b90506000600860009054906101000a90046001600160a01b03166001600160a01b031663971e38cf6040518163ffffffff1660e01b8152600401600060405180830381865afa158015610f99573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610fc191908101906127e9565b90506000602954828481518110610fda57610fda61286e565b602002602001015185610fed919061298f565b610ff791906128cb565b9695505050505050565b6001546001600160a01b031690565b6110198161086c565b60008181526014602090815260408083205460159092528083205460085491516331a9108f60e11b8152600481018690529293909290916001600160a01b031690636352211e90602401602060405180830381865afa158015611080573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a491906129ae565b90506000805b86518210156110ec578682815181106110c5576110c561286e565b6020026020010151816110d8919061289a565b9050816110e4816128b2565b9250506110aa565b60008092505b87518310156111dd576008546040516335313c2160e11b81526000916001600160a01b031690636a6278429061112c908890600401612612565b6020604051808303816000875af115801561114b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061116f9190612976565b905061117a81610ae1565b8289858151811061118d5761118d61286e565b6020026020010151886111a0919061298f565b6111aa91906128cb565b600091825260156020908152604080842089905560149091529091208190559050826111d5816128b2565b9350506110f2565b60008781526014602090815260408083208390556015909152808220919091556008549051630852cd8d60e31b8152600481018990526001600160a01b03909116906342966c6890602401600060405180830381600087803b15801561124257600080fd5b505af1158015611256573d6000803e3d6000fd5b505050507f5b0451527e2e53721942be9de26caf341de2182e40d295d01cf39f7a378ed5a787858a60405161128d939291906129cb565b60405180910390a15050505050505050565b600080600860009054906101000a90046001600160a01b03166001600160a01b031663971e38cf6040518163ffffffff1660e01b8152600401600060405180830381865afa1580156112f5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261131d91908101906127e9565b90506000805b601081101561139d578251811015611352578281815181106113475761134761286e565b602002602001015191505b60295482601983601081106113695761136961286e565b0154611375919061298f565b61137f91906128cb565b611389908561289a565b935080611395816128b2565b915050611323565b50505090565b8082036113af57600080fd5b600081815260156020526040808220548483529120541461142b5760405162461bcd60e51b815260206004820152603060248201527f4d61747572697479206c6576656c2073686f756c64206265207468652073616d60448201526f6520696e20626f7468206d614e46547360801b606482015260840161088e565b6114348261086c565b61143d8161086c565b6000828152601460205260408082205483835290822080549192909161146490849061289a565b909155505060008281526014602090815260408083208390556015909152808220919091556008549051630852cd8d60e31b8152600481018490526001600160a01b03909116906342966c6890602401600060405180830381600087803b1580156114ce57600080fd5b505af11580156114e2573d6000803e3d6000fd5b505050507f57cbf6e95161d2e3d8956cef5d6a37ceac1d449f2f97d746fff873c9a1a8fb3d82826040516115179291906127c1565b60405180910390a15050565b6017544210610cd75760008060005b61153e600160106128ed565b81101561158957601981601081106115585761155861286e565b0154915082601982601081106115705761157061286e565b0155909150819080611581816128b2565b915050611532565b50816019611599600160106128ed565b601081106115a9576115a961286e565b01546115b5919061289a565b60196115c3600160106128ed565b601081106115d3576115d361286e565b01556018546017546115e5919061289a565b6017555050565b60026000540361160e5760405162461bcd60e51b815260040161088e90612904565b60026000556005546001600160a01b031633146116805760405162461bcd60e51b815260206004820152602a60248201527f43616c6c6572206973206e6f742052657761726473446973747269627574696f6044820152691b8818dbdb9d1c9858dd60b21b606482015260840161088e565b61168a6000610ae1565b6002546001600160a01b038381169116146116a457600080fd5b6005546002546116c2916001600160a01b0391821691163084611fec565b600a5442106116e1576009546116d99082906119ef565b600b55611724565b600a546000906116f190426119d7565b9050600061170a600b54836119e390919063ffffffff16565b60095490915061171e9061072f85846119fb565b600b5550505b6002546040516370a0823160e01b81526000916001600160a01b0316906370a0823190611755903090600401612612565b602060405180830381865afa158015611772573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117969190612976565b90506117ad600954826119ef90919063ffffffff16565b600b5411156117f95760405162461bcd60e51b81526020600482015260186024820152770a0e4deecd2c8cac840e4caeec2e4c840e8dede40d0d2ced60431b604482015260640161088e565b42600c81905560095461180c91906119fb565b600a556040518281527fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9060200160405180910390a15050600160005550565b6000610b768233611d65565b600061186261129f565b6000036118705750600d5490565b610b8e61189e61187e61129f565b61072f670de0b6b3a7640000610729600b54610729600c54610701610e5e565b600d54906119fb565b6000806002600054036118cc5760405162461bcd60e51b815260040161088e90612904565b60026000556118d961202a565b9150915060016000559091565b600480546040516370a0823160e01b8152600092610b8e926001600160a01b0316916370a082319161191a91339101612612565b602060405180830381865afa158015611937573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061195b9190612976565b33611d65565b611969611f25565b6001600160a01b0381166119ce5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161088e565b610ade81611f84565b6000610cbe82846128ed565b6000610cbe828461298f565b6000610cbe82846128cb565b6000610cbe828461289a565b611a5d8363a9059cbb60e01b8484604051602401611a2692919061293b565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261238d565b505050565b600260005403611a845760405162461bcd60e51b815260040161088e90612904565b600260005560085460405163430c208160e01b81526001600160a01b039091169063430c208190611abb903390859060040161293b565b602060405180830381865afa158015611ad8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611afc9190612954565b611b0557600080fd5b6008546040516305ff561360e51b8152600481018390526001600160a01b039091169063bfeac26090602401602060405180830381865afa158015611b4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b729190612954565b611b7b57600080fd5b611b8481610ae1565b60008181526014602052604090205481611bb05760405162461bcd60e51b815260040161088e90612a2a565b60008111611bd05760405162461bcd60e51b815260040161088e90612a2a565b601354600090611be090836119d7565b1015611c1b5760405162461bcd60e51b815260206004820152600a6024820152690737570706c79203c20360b41b604482015260640161088e565b601354611c2890826119d7565b6013556000611c3683610762565b90508160198260108110611c4c57611c4c61286e565b0154611c5891906128ed565b60198260108110611c6b57611c6b61286e565b0155600083815260146020526040902054611c8690836119d7565b60008481526014602090815260408083209390935560159052818120556008549051630852cd8d60e31b8152600481018590526001600160a01b03909116906342966c6890602401600060405180830381600087803b158015611ce857600080fd5b505af1158015611cfc573d6000803e3d6000fd5b5050600454611d1892506001600160a01b031690503384611a07565b336001600160a01b03167ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5688484604051611d539291906127c1565b60405180910390a25050600160005550565b6000600260005403611d895760405162461bcd60e51b815260040161088e90612904565b600260005582611ddb5760405162461bcd60e51b815260206004820152601e60248201527f6465706f736974284761756765293a2063616e6e6f74207374616b6520300000604482015260640161088e565b6008546040516335313c2160e11b81526001600160a01b0390911690636a62784290611e0b908590600401612612565b6020604051808303816000875af1158015611e2a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e4e9190612976565b9050611e5981610ae1565b600081815260146020526040902054611e7290846119fb565b600082815260146020526040902055601854611e8e90426128cb565b600082815260156020526040902055601954611eab90849061289a565b601955601354611ebc90849061289a565b601355600454611ed7906001600160a01b0316333086611fec565b816001600160a01b03167f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a158285604051611f129291906127c1565b60405180910390a2600160005592915050565b33611f2e611001565b6001600160a01b031614610cd75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161088e565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000818310611fe55781610cbe565b5090919050565b6040516001600160a01b03808516602483015283166044820152606481018290526120249085906323b872dd60e01b90608401611a26565b50505050565b6001546000908190600160a01b900460ff166120495750600091829150565b600480546040805163d294f09360e01b815281516001600160a01b0390931693849363d294f093938383019390929082900301816000875af1158015612093573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120b79190612a54565b9093509150821515806120ca5750600082115b1561238857600083600f546120df919061289a565b90506000836010546120f1919061289a565b9050600080846001600160a01b0316639d63848a6040518163ffffffff1660e01b81526004016040805180830381865afa158015612133573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121579190612a78565b90925090508315612248576000600f5560065460405163095ea7b360e01b81526001600160a01b038481169263095ea7b39261219b9290911690889060040161293b565b6020604051808303816000875af11580156121ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121de9190612954565b5060065460405163b66503cf60e01b81526001600160a01b039091169063b66503cf90612211908590889060040161293b565b600060405180830381600087803b15801561222b57600080fd5b505af115801561223f573d6000803e3d6000fd5b5050505061224e565b600f8490555b821561233a57600060105560065460405163095ea7b360e01b81526001600160a01b038381169263095ea7b39261228d9290911690879060040161293b565b6020604051808303816000875af11580156122ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122d09190612954565b5060065460405163b66503cf60e01b81526001600160a01b039091169063b66503cf90612303908490879060040161293b565b600060405180830381600087803b15801561231d57600080fd5b505af1158015612331573d6000803e3d6000fd5b50505050612340565b60108390555b336001600160a01b03167fbc567d6cbad26368064baa0ab5a757be46aae4d70f707f9203d9d9b6c8ccbfa3888860405161237b9291906127c1565b60405180910390a2505050505b509091565b60006123e2826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661245f9092919063ffffffff16565b805190915015611a5d57808060200190518101906124009190612954565b611a5d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161088e565b606061246e8484600085612476565b949350505050565b6060824710156124d75760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161088e565b6001600160a01b0385163b61252e5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161088e565b600080866001600160a01b0316858760405161254a9190612ad3565b60006040518083038185875af1925050503d8060008114612587576040519150601f19603f3d011682016040523d82523d6000602084013e61258c565b606091505b509150915061259c8282866125a7565b979650505050505050565b606083156125b6575081610cbe565b8251156125c65782518084602001fd5b8160405162461bcd60e51b815260040161088e9190612aef565b6001600160a01b0381168114610ade57600080fd5b60006020828403121561260757600080fd5b8135610cbe816125e0565b6001600160a01b0391909116815260200190565b60006020828403121561263857600080fd5b5035919050565b6000806040838503121561265257600080fd5b823591506020830135612664816125e0565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156126ad576126ad61266f565b604052919050565b60006001600160401b038211156126ce576126ce61266f565b5060051b60200190565b600080604083850312156126eb57600080fd5b82356001600160401b0381111561270157600080fd5b8301601f8101851361271257600080fd5b80356020612727612722836126b5565b612685565b82815260059290921b8301810191818101908884111561274657600080fd5b938201935b838510156127645784358252938201939082019061274b565b98969091013596505050505050565b6000806040838503121561278657600080fd5b50508035926020909101359150565b600080604083850312156127a857600080fd5b82356127b3816125e0565b946020939093013593505050565b918252602082015260400190565b6001600160a01b0392831681529116602082015260400190565b600060208083850312156127fc57600080fd5b82516001600160401b0381111561281257600080fd5b8301601f8101851361282357600080fd5b8051612831612722826126b5565b81815260059190911b8201830190838101908783111561285057600080fd5b928401925b8284101561259c57835182529284019290840190612855565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600082198211156128ad576128ad612884565b500190565b6000600182016128c4576128c4612884565b5060010190565b6000826128e857634e487b7160e01b600052601260045260246000fd5b500490565b6000828210156128ff576128ff612884565b500390565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6001600160a01b03929092168252602082015260400190565b60006020828403121561296657600080fd5b81518015158114610cbe57600080fd5b60006020828403121561298857600080fd5b5051919050565b60008160001904831182151516156129a9576129a9612884565b500290565b6000602082840312156129c057600080fd5b8151610cbe816125e0565b8381526001600160a01b0383166020808301919091526060604083018190528351908301819052600091848101916080850190845b81811015612a1c57845183529383019391830191600101612a00565b509098975050505050505050565b60208082526010908201526f1d1bdad95b88135d5cdd08115e1a5cdd60821b604082015260600190565b60008060408385031215612a6757600080fd5b505080516020909101519092909150565b60008060408385031215612a8b57600080fd5b8251612a96816125e0565b6020840151909250612664816125e0565b60005b83811015612ac2578181015183820152602001612aaa565b838111156120245750506000910152565b60008251612ae5818460208701612aa7565b9190910192915050565b6020815260008251806020840152612b0e816040850160208701612aa7565b601f01601f1916919091016040019291505056fea264697066735822122057bc9110a483425e0f527e9d25242eacff2b43a6fc9a1b0fe20683736c89776a64736f6c634300080d003300000000000000000000000015b2fb8f08e4ac1ce019eadae02ee92aedf068510000000000000000000000009a01857f33aa382b1d5bb96c3180347862432b0d0000000000000000000000000df5f52afa0308fdd65423234c4fda9add0b9eba000000000000000000000000c72b5c6d2c33063e89a50b2f77c99193ae6cee6c00000000000000000000000070e2194b1a4a6a3ef6f100dbc5f53c22b1a1bc3b0000000000000000000000005c01a951284448f16f5cf0fc6bbc46ee81d48bf200000000000000000000000000000000000000000000000000000000000000010000000000000000000000009774ae804e6662385f5ab9b01417bc2c6e548468000000000000000000000000000000000000000000000000000000000000000d

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.