AVAX Price: $22.79 (+11.27%)
Gas: 1.8 nAVAX
 

Overview

AVAX Balance

Avalanche C-Chain LogoAvalanche C-Chain LogoAvalanche C-Chain Logo0 AVAX

AVAX Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Deposit105285792022-02-05 17:44:351172 days ago1644083075IN
0x28A4e13f...12611f87A
0 AVAX0.0012018525

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

Contract Source Code Verified (Exact Match)

Contract Name:
MasterPlatypus

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion
File 1 of 21 : MasterPlatypus.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

import '@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol';
import '@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol';
import '@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol';
import '@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol';
import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';
import '@openzeppelin/contracts/token/ERC20/ERC20.sol';
import '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';
import '@openzeppelin/contracts/utils/Address.sol';
import '@openzeppelin/contracts/utils/math/SafeMath.sol';
import './libraries/Math.sol';
import './interfaces/IVePtp.sol';
import './interfaces/IPtp.sol';
import './interfaces/IMasterPlatypus.sol';
import './interfaces/IRewarder.sol';

/// MasterPlatypus is a boss. He says "go f your blocks maki boy, I'm gonna use timestamp instead"
/// In addition, he feeds himself from Venom. So, vePtp holders boost their (non-dialuting) emissions.
/// This contract rewards users in function of their amount of lp staked (dialuting pool) factor (non-dialuting pool)
/// Factor and sumOfFactors are updated by contract VePtp.sol after any vePtp minting/burning (veERC20Upgradeable hook).
/// Note that it's ownable and the owner wields tremendous power. The ownership
/// will be transferred to a governance smart contract once Platypus is sufficiently
/// distributed and the community can show to govern itself.
contract MasterPlatypus is
    Initializable,
    OwnableUpgradeable,
    ReentrancyGuardUpgradeable,
    PausableUpgradeable,
    IMasterPlatypus
{
    using SafeERC20 for IERC20;
    using EnumerableSet for EnumerableSet.AddressSet;

    // Info of each user.
    struct UserInfo {
        uint256 amount; // How many LP tokens the user has provided.
        uint256 rewardDebt; // Reward debt. See explanation below.
        uint256 factor; // non-dialuting factor = sqrt (lpAmount * vePtp.balanceOf())
        //
        // We do some fancy math here. Basically, any point in time, the amount of PTPs
        // entitled to a user but is pending to be distributed is:
        //
        //   ((user.amount * pool.accPtpPerShare + user.factor * pool.accPtpPerFactorShare) / 1e12) -
        //        user.rewardDebt
        //
        // Whenever a user deposits or withdraws LP tokens to a pool. Here's what happens:
        //   1. The pool's `accPtpPerShare`, `accPtpPerFactorShare` (and `lastRewardTimestamp`) gets updated.
        //   2. User receives the pending reward sent to his/her address.
        //   3. User's `amount` gets updated.
        //   4. User's `rewardDebt` gets updated.
    }

    // Info of each pool.
    struct PoolInfo {
        IERC20 lpToken; // Address of LP token contract.
        uint256 allocPoint; // How many allocation points assigned to this pool. PTPs to distribute per second.
        uint256 lastRewardTimestamp; // Last timestamp that PTPs distribution occurs.
        uint256 accPtpPerShare; // Accumulated PTPs per share, times 1e12.
        IRewarder rewarder;
        uint256 sumOfFactors; // the sum of all non dialuting factors by all of the users in the pool
        uint256 accPtpPerFactorShare; // accumulated ptp per factor share
    }

    // The strongest platypus out there (ptp token).
    IERC20 public ptp;
    // Venom does not seem to hurt the Platypus, it only makes it stronger.
    IVePtp public vePtp;
    // New Master Platypus address for future migrations
    IMasterPlatypus newMasterPlatypus;
    // PTP tokens created per second.
    uint256 public ptpPerSec;
    // Emissions: both must add to 1000 => 100%
    // Dialuting emissions repartition (e.g. 300 for 30%)
    uint256 public dialutingRepartition;
    // Non-dialuting emissions repartition (e.g. 500 for 50%)
    uint256 public nonDialutingRepartition;
    // Total allocation points. Must be the sum of all allocation points in all pools.
    uint256 public totalAllocPoint;
    // The timestamp when PTP mining starts.
    uint256 public startTimestamp;
    // Info of each pool.
    PoolInfo[] public poolInfo;
    // Set of all LP tokens that have been added as pools
    EnumerableSet.AddressSet private lpTokens;
    // Info of each user that stakes LP tokens.
    mapping(uint256 => mapping(address => UserInfo)) public userInfo;
    // Amount of claimable ptp the user has
    mapping(uint256 => mapping(address => uint256)) public claimablePtp;

    event Add(uint256 indexed pid, uint256 allocPoint, IERC20 indexed lpToken, IRewarder indexed rewarder);
    event Set(uint256 indexed pid, uint256 allocPoint, IRewarder indexed rewarder, bool overwrite);
    event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
    event DepositFor(address indexed user, uint256 indexed pid, uint256 amount);
    event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
    event UpdatePool(uint256 indexed pid, uint256 lastRewardTimestamp, uint256 lpSupply, uint256 accPtpPerShare);
    event Harvest(address indexed user, uint256 indexed pid, uint256 amount);
    event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
    event UpdateEmissionRate(address indexed user, uint256 ptpPerSec);
    event UpdateEmissionRepartition(
        address indexed user,
        uint256 dialutingRepartition,
        uint256 nonDialutingRepartition
    );
    event UpdateVePTP(address indexed user, address oldVePTP, address newVePTP);

    /// @dev Modifier ensuring that certain function can only be called by VePtp
    modifier onlyVePtp() {
        require(address(vePtp) == msg.sender, 'notVePtp: wut?');
        _;
    }

    function initialize(
        IERC20 _ptp,
        IVePtp _vePtp,
        uint256 _ptpPerSec,
        uint256 _dialutingRepartition,
        uint256 _startTimestamp
    ) external initializer {
        require(address(_ptp) != address(0), 'ptp address cannot be zero');
        require(address(_vePtp) != address(0), 'vePtp address cannot be zero');
        require(_ptpPerSec != 0, 'ptp per sec cannot be zero');
        require(_dialutingRepartition <= 1000, 'dialuting repartition must be in range 0, 1000');

        __Ownable_init();
        __ReentrancyGuard_init_unchained();
        __Pausable_init_unchained();

        ptp = _ptp;
        vePtp = _vePtp;
        ptpPerSec = _ptpPerSec;
        dialutingRepartition = _dialutingRepartition;
        nonDialutingRepartition = 1000 - _dialutingRepartition;
        startTimestamp = _startTimestamp;
        totalAllocPoint = 0;
    }

    /**
     * @dev pause pool, restricting certain operations
     */
    function pause() external onlyOwner {
        _pause();
    }

    /**
     * @dev unpause pool, enabling certain operations
     */
    function unpause() external onlyOwner {
        _unpause();
    }

    function setNewMasterPlatypus(IMasterPlatypus _newMasterPlatypus) external onlyOwner {
        newMasterPlatypus = _newMasterPlatypus;
    }

    /// @notice returns pool length
    function poolLength() external view override returns (uint256) {
        return poolInfo.length;
    }

    /// @notice Add a new lp to the pool. Can only be called by the owner.
    /// @dev Reverts if the same LP token is added more than once.
    /// @param _allocPoint allocation points for this LP
    /// @param _lpToken the corresponding lp token
    /// @param _rewarder the rewarder
    function add(
        uint256 _allocPoint,
        IERC20 _lpToken,
        IRewarder _rewarder
    ) public onlyOwner {
        require(Address.isContract(address(_lpToken)), 'add: LP token must be a valid contract');
        require(
            Address.isContract(address(_rewarder)) || address(_rewarder) == address(0),
            'add: rewarder must be contract or zero'
        );
        require(!lpTokens.contains(address(_lpToken)), 'add: LP already added');

        // update all pools
        massUpdatePools();

        // update last time rewards were calculated to now
        uint256 lastRewardTimestamp = block.timestamp > startTimestamp ? block.timestamp : startTimestamp;

        // add _allocPoint to total alloc points
        totalAllocPoint = totalAllocPoint + _allocPoint;

        // update PoolInfo with the new LP
        poolInfo.push(
            PoolInfo({
                lpToken: _lpToken,
                allocPoint: _allocPoint,
                lastRewardTimestamp: lastRewardTimestamp,
                accPtpPerShare: 0,
                rewarder: _rewarder,
                sumOfFactors: 0,
                accPtpPerFactorShare: 0
            })
        );

        // add lpToken to the lpTokens enumerable set
        lpTokens.add(address(_lpToken));
        emit Add(poolInfo.length - 1, _allocPoint, _lpToken, _rewarder);
    }

    /// @notice Update the given pool's PTP allocation point. Can only be called by the owner.
    /// @param _pid the pool id
    /// @param _allocPoint allocation points
    /// @param _rewarder the rewarder
    /// @param overwrite overwrite rewarder?
    function set(
        uint256 _pid,
        uint256 _allocPoint,
        IRewarder _rewarder,
        bool overwrite
    ) public onlyOwner {
        require(
            Address.isContract(address(_rewarder)) || address(_rewarder) == address(0),
            'set: rewarder must be contract or zero'
        );
        massUpdatePools();
        totalAllocPoint = totalAllocPoint - poolInfo[_pid].allocPoint + _allocPoint;
        poolInfo[_pid].allocPoint = _allocPoint;
        if (overwrite) {
            poolInfo[_pid].rewarder = _rewarder;
        }
        emit Set(_pid, _allocPoint, overwrite ? _rewarder : poolInfo[_pid].rewarder, overwrite);
    }

    /// @notice View function to see pending PTPs on frontend.
    /// @param _pid the pool id
    /// @param _user the user address
    /// TODO include factor operations
    function pendingTokens(uint256 _pid, address _user)
        external
        view
        override
        returns (
            uint256 pendingPtp,
            address bonusTokenAddress,
            string memory bonusTokenSymbol,
            uint256 pendingBonusToken
        )
    {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][_user];
        uint256 accPtpPerShare = pool.accPtpPerShare;
        uint256 accPtpPerFactorShare = pool.accPtpPerFactorShare;
        uint256 lpSupply = pool.lpToken.balanceOf(address(this));
        if (block.timestamp > pool.lastRewardTimestamp && lpSupply != 0) {
            uint256 secondsElapsed = block.timestamp - pool.lastRewardTimestamp;
            uint256 ptpReward = (secondsElapsed * ptpPerSec * pool.allocPoint) / totalAllocPoint;
            accPtpPerShare += (ptpReward * 1e12 * dialutingRepartition) / (lpSupply * 1000);
            if (pool.sumOfFactors != 0) {
                accPtpPerFactorShare += (ptpReward * 1e12 * nonDialutingRepartition) / (pool.sumOfFactors * 1000);
            }
        }
        pendingPtp =
            ((user.amount * accPtpPerShare + user.factor * accPtpPerFactorShare) / 1e12) +
            claimablePtp[_pid][_user] -
            user.rewardDebt;
        // If it's a double reward farm, we return info about the bonus token
        if (address(pool.rewarder) != address(0)) {
            (bonusTokenAddress, bonusTokenSymbol) = rewarderBonusTokenInfo(_pid);
            pendingBonusToken = pool.rewarder.pendingTokens(_user);
        }
    }

    /// @notice Get bonus token info from the rewarder contract for a given pool, if it is a double reward farm
    /// @param _pid the pool id
    function rewarderBonusTokenInfo(uint256 _pid)
        public
        view
        override
        returns (address bonusTokenAddress, string memory bonusTokenSymbol)
    {
        PoolInfo storage pool = poolInfo[_pid];
        if (address(pool.rewarder) != address(0)) {
            bonusTokenAddress = address(pool.rewarder.rewardToken());
            bonusTokenSymbol = IERC20Metadata(pool.rewarder.rewardToken()).symbol();
        }
    }

    /// @notice Update reward variables for all pools.
    /// @dev Be careful of gas spending!
    function massUpdatePools() public override {
        uint256 length = poolInfo.length;
        for (uint256 pid = 0; pid < length; ++pid) {
            _updatePool(pid);
        }
    }

    /// @notice Update reward variables of the given pool to be up-to-date.
    /// @param _pid the pool id
    function updatePool(uint256 _pid) external override {
        _updatePool(_pid);
    }

    function _updatePool(uint256 _pid) private {
        PoolInfo storage pool = poolInfo[_pid];
        // update only if now > last time we updated rewards
        if (block.timestamp > pool.lastRewardTimestamp) {
            uint256 lpSupply = pool.lpToken.balanceOf(address(this));

            // if balance of lp supply is 0, update lastRewardTime and quit function
            if (lpSupply == 0) {
                pool.lastRewardTimestamp = block.timestamp;
                return;
            }
            // calculate seconds elapsed since last update
            uint256 secondsElapsed = block.timestamp - pool.lastRewardTimestamp;

            // calculate ptp reward
            uint256 ptpReward = (secondsElapsed * ptpPerSec * pool.allocPoint) / totalAllocPoint;

            // update accPtpPerShare to reflect dialuting rewards
            pool.accPtpPerShare += (ptpReward * 1e12 * dialutingRepartition) / (lpSupply * 1000);

            // update accPtpPerFactorShare to reflect non-dialuting rewards
            if (pool.sumOfFactors == 0) {
                pool.accPtpPerFactorShare = 0;
            } else {
                pool.accPtpPerFactorShare += (ptpReward * 1e12 * nonDialutingRepartition) / (pool.sumOfFactors * 1000);
            }

            // update lastRewardTimestamp to now
            pool.lastRewardTimestamp = block.timestamp;
            emit UpdatePool(_pid, pool.lastRewardTimestamp, lpSupply, pool.accPtpPerShare);
        }
    }

    /// @notice Helper function to migrate fund from multiple pools to the new MasterPlatypus.
    /// @notice user must initiate transaction from masterchef
    /// @dev Assume the orginal MasterPlatypus has stopped emisions
    /// hence we can skip updatePool() to save gas cost
    function migrate(uint256[] calldata _pids) external override nonReentrant {
        require(address(newMasterPlatypus) != (address(0)), 'to where?');

        _multiClaim(_pids);
        for (uint256 i = 0; i < _pids.length; ++i) {
            uint256 pid = _pids[i];
            UserInfo storage user = userInfo[pid][msg.sender];

            if (user.amount > 0) {
                PoolInfo storage pool = poolInfo[pid];
                pool.lpToken.approve(address(newMasterPlatypus), user.amount);
                newMasterPlatypus.depositFor(pid, user.amount, msg.sender);

                user.amount = 0;
                // As we assume the MasterPlatypus has stopped emission so that we can skip updating
                // user.factor and pool.sumOfFactors
            }
        }
    }

    /// @notice Deposit LP tokens to MasterChef for PTP allocation on behalf of user
    /// @dev user must initiate transaction from masterchef
    /// @param _pid the pool id
    /// @param _amount amount to deposit
    /// @param _user the user being represented
    function depositFor(
        uint256 _pid,
        uint256 _amount,
        address _user
    ) external override nonReentrant {
        require(tx.origin == _user, 'depositFor: wut?');

        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][_user];

        // update pool in case user has deposited
        _updatePool(_pid);
        if (user.amount > 0) {
            // Harvest PTP
            uint256 pending = ((user.amount * pool.accPtpPerShare + user.factor * pool.accPtpPerFactorShare) / 1e12) +
                claimablePtp[_pid][msg.sender] -
                user.rewardDebt;
            claimablePtp[_pid][msg.sender] = 0;

            pending = safePtpTransfer(payable(_user), pending);
            emit Harvest(_user, _pid, pending);
        }

        // update amount of lp staked by user
        user.amount += _amount;

        // update non-dialuting factor
        uint256 oldFactor = user.factor;
        user.factor = Math.sqrt(user.amount * vePtp.balanceOf(_user));
        pool.sumOfFactors = pool.sumOfFactors + user.factor - oldFactor;

        // update reward debt
        user.rewardDebt = (user.amount * pool.accPtpPerShare + user.factor * pool.accPtpPerFactorShare) / 1e12;

        IRewarder rewarder = poolInfo[_pid].rewarder;
        if (address(rewarder) != address(0)) {
            rewarder.onPtpReward(_user, user.amount);
        }

        pool.lpToken.safeTransferFrom(msg.sender, address(this), _amount);
        emit DepositFor(_user, _pid, _amount);
    }

    /// @notice Deposit LP tokens to MasterChef for PTP allocation.
    /// @dev it is possible to call this function with _amount == 0 to claim current rewards
    /// @param _pid the pool id
    /// @param _amount amount to deposit
    function deposit(uint256 _pid, uint256 _amount)
        external
        override
        nonReentrant
        whenNotPaused
        returns (uint256, uint256)
    {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];
        _updatePool(_pid);
        uint256 pending;
        if (user.amount > 0) {
            // Harvest PTP
            pending =
                ((user.amount * pool.accPtpPerShare + user.factor * pool.accPtpPerFactorShare) / 1e12) +
                claimablePtp[_pid][msg.sender] -
                user.rewardDebt;
            claimablePtp[_pid][msg.sender] = 0;

            pending = safePtpTransfer(payable(msg.sender), pending);
            emit Harvest(msg.sender, _pid, pending);
        }

        // update amount of lp staked by user
        user.amount += _amount;

        // update non-dialuting factor
        uint256 oldFactor = user.factor;
        user.factor = Math.sqrt(user.amount * vePtp.balanceOf(msg.sender));
        pool.sumOfFactors = pool.sumOfFactors + user.factor - oldFactor;

        // update reward debt
        user.rewardDebt = (user.amount * pool.accPtpPerShare + user.factor * pool.accPtpPerFactorShare) / 1e12;

        IRewarder rewarder = poolInfo[_pid].rewarder;
        uint256 additionalRewards;
        if (address(rewarder) != address(0)) {
            additionalRewards = rewarder.onPtpReward(msg.sender, user.amount);
        }

        pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount);
        emit Deposit(msg.sender, _pid, _amount);
        return (pending, additionalRewards);
    }

    /// @notice claims rewards for multiple pids
    /// @param _pids array pids, pools to claim
    function multiClaim(uint256[] memory _pids)
        external
        override
        nonReentrant
        whenNotPaused
        returns (
            uint256,
            uint256[] memory,
            uint256[] memory
        )
    {
        return _multiClaim(_pids);
    }

    /// @notice private function to claim rewards for multiple pids
    /// @param _pids array pids, pools to claim
    function _multiClaim(uint256[] memory _pids)
        private
        returns (
            uint256,
            uint256[] memory,
            uint256[] memory
        )
    {
        // accumulate rewards for each one of the pids in pending
        uint256 pending;
        uint256[] memory amounts = new uint256[](_pids.length);
        uint256[] memory additionalRewards = new uint256[](_pids.length);
        for (uint256 i = 0; i < _pids.length; ++i) {
            _updatePool(_pids[i]);
            PoolInfo storage pool = poolInfo[_pids[i]];
            UserInfo storage user = userInfo[_pids[i]][msg.sender];
            if (user.amount > 0) {
                // increase pending to send all rewards once
                uint256 poolRewards = ((user.amount * pool.accPtpPerShare + user.factor * pool.accPtpPerFactorShare) /
                    1e12) +
                    claimablePtp[_pids[i]][msg.sender] -
                    user.rewardDebt;

                claimablePtp[_pids[i]][msg.sender] = 0;

                // update reward debt
                user.rewardDebt = (user.amount * pool.accPtpPerShare + user.factor * pool.accPtpPerFactorShare) / 1e12;

                // increase pending
                pending += poolRewards;

                amounts[i] = poolRewards;
                // if existant, get external rewarder rewards for pool
                IRewarder rewarder = pool.rewarder;
                if (address(rewarder) != address(0)) {
                    additionalRewards[i] = rewarder.onPtpReward(msg.sender, user.amount);
                }
            }
        }
        // transfer all remaining rewards
        uint256 transfered = safePtpTransfer(payable(msg.sender), pending);
        if (transfered != pending) {
            for (uint256 i = 0; i < _pids.length; ++i) {
                amounts[i] = (transfered * amounts[i]) / pending;
                emit Harvest(msg.sender, _pids[i], amounts[i]);
            }
        } else {
            for (uint256 i = 0; i < _pids.length; ++i) {
                // emit event for pool
                emit Harvest(msg.sender, _pids[i], amounts[i]);
            }
        }

        return (transfered, amounts, additionalRewards);
    }

    /// @notice Withdraw LP tokens from MasterPlatypus.
    /// @notice Automatically harvest pending rewards and sends to user
    /// @param _pid the pool id
    /// @param _amount the amount to withdraw
    function withdraw(uint256 _pid, uint256 _amount)
        external
        override
        nonReentrant
        whenNotPaused
        returns (uint256, uint256)
    {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];
        require(user.amount >= _amount, 'withdraw: not good');

        _updatePool(_pid);

        // Harvest PTP
        uint256 pending = ((user.amount * pool.accPtpPerShare + user.factor * pool.accPtpPerFactorShare) / 1e12) +
            claimablePtp[_pid][msg.sender] -
            user.rewardDebt;
        claimablePtp[_pid][msg.sender] = 0;

        pending = safePtpTransfer(payable(msg.sender), pending);
        emit Harvest(msg.sender, _pid, pending);

        // for non-dialuting factor
        uint256 oldFactor = user.factor;

        // update amount of lp staked
        user.amount = user.amount - _amount;

        // update non-dialuting factor
        user.factor = Math.sqrt(user.amount * vePtp.balanceOf(msg.sender));
        pool.sumOfFactors = pool.sumOfFactors + user.factor - oldFactor;

        // update reward debt
        user.rewardDebt = (user.amount * pool.accPtpPerShare + user.factor * pool.accPtpPerFactorShare) / 1e12;

        IRewarder rewarder = poolInfo[_pid].rewarder;
        uint256 additionalRewards = 0;
        if (address(rewarder) != address(0)) {
            additionalRewards = rewarder.onPtpReward(msg.sender, user.amount);
        }

        pool.lpToken.safeTransfer(address(msg.sender), _amount);
        emit Withdraw(msg.sender, _pid, _amount);
        return (pending, additionalRewards);
    }

    /// @notice Withdraw without caring about rewards. EMERGENCY ONLY.
    /// @param _pid the pool id
    function emergencyWithdraw(uint256 _pid) public nonReentrant {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];
        pool.lpToken.safeTransfer(address(msg.sender), user.amount);

        // update non-dialuting factor
        pool.sumOfFactors = pool.sumOfFactors - user.factor;
        user.factor = 0;

        // update dialuting factors
        user.amount = 0;
        user.rewardDebt = 0;

        emit EmergencyWithdraw(msg.sender, _pid, user.amount);
    }

    /// @notice Safe ptp transfer function, just in case if rounding error causes pool to not have enough PTPs.
    /// @param _to beneficiary
    /// @param _amount the amount to transfer
    function safePtpTransfer(address payable _to, uint256 _amount) private returns (uint256) {
        uint256 ptpBal = ptp.balanceOf(address(this));

        // perform additional check in case there are no more ptp tokens to distribute.
        // emergency withdraw would be necessary
        require(ptpBal > 0, 'No tokens to distribute');

        if (_amount > ptpBal) {
            ptp.transfer(_to, ptpBal);
            return ptpBal;
        } else {
            ptp.transfer(_to, _amount);
            return _amount;
        }
    }

    /// @notice updates emission rate
    /// @param _ptpPerSec ptp amount to be updated
    /// @dev Pancake has to add hidden dummy pools inorder to alter the emission,
    /// @dev here we make it simple and transparent to all.
    function updateEmissionRate(uint256 _ptpPerSec) external onlyOwner {
        massUpdatePools();
        ptpPerSec = _ptpPerSec;
        emit UpdateEmissionRate(msg.sender, _ptpPerSec);
    }

    /// @notice updates emission repartition
    /// @param _dialutingRepartition the future dialuting repartition
    function updateEmissionRepartition(uint256 _dialutingRepartition) external onlyOwner {
        require(_dialutingRepartition <= 1000);
        massUpdatePools();
        dialutingRepartition = _dialutingRepartition;
        nonDialutingRepartition = 1000 - _dialutingRepartition;
        emit UpdateEmissionRepartition(msg.sender, _dialutingRepartition, 1000 - _dialutingRepartition);
    }

    /// @notice updates vePtp address
    /// @param _newVePtp the new VePtp address
    function setVePtp(IVePtp _newVePtp) external onlyOwner {
        require(address(_newVePtp) != address(0));
        massUpdatePools();
        IVePtp oldVePtp = vePtp;
        vePtp = _newVePtp;
        emit UpdateVePTP(msg.sender, address(oldVePtp), address(_newVePtp));
    }

    /// @notice updates factor after any vePtp token operation (minting/burning)
    /// @param _user the user to update
    /// @param _newVePtpBalance the amount of vePTP
    /// @dev can only be called by vePtp
    function updateFactor(address _user, uint256 _newVePtpBalance) external override onlyVePtp {
        // loop over each pool : beware gas cost!
        uint256 length = poolInfo.length;

        for (uint256 pid = 0; pid < length; ++pid) {
            UserInfo storage user = userInfo[pid][_user];

            // skip if user doesn't have any deposit in the pool
            if (user.amount == 0) {
                continue;
            }

            PoolInfo storage pool = poolInfo[pid];

            // first, update pool
            _updatePool(pid);
            // calculate pending
            uint256 pending = ((user.amount * pool.accPtpPerShare + user.factor * pool.accPtpPerFactorShare) / 1e12) -
                user.rewardDebt;
            // increase claimablePtp
            claimablePtp[pid][_user] += pending;
            // get oldFactor
            uint256 oldFactor = user.factor; // get old factor
            // calculate newFactor using
            uint256 newFactor = Math.sqrt(_newVePtpBalance * user.amount);
            // update user factor
            user.factor = newFactor;
            // update reward debt, take into account newFactor
            user.rewardDebt = (user.amount * pool.accPtpPerShare + newFactor * pool.accPtpPerFactorShare) / 1e12;
            // also, update sumOfFactors
            pool.sumOfFactors = pool.sumOfFactors + newFactor - oldFactor;
        }
    }

    /// @notice In case we need to manually migrate PTP funds from MasterChef
    /// Sends all remaining ptp from the contract to the owner
    function emergencyPtpWithdraw() external onlyOwner {
        ptp.safeTransfer(address(msg.sender), ptp.balanceOf(address(this)));
    }
}

File 2 of 21 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

    function __Ownable_init_unchained() internal initializer {
        _setOwner(_msgSender());
    }

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        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 {
        _setOwner(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");
        _setOwner(newOwner);
    }

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
    uint256[49] private __gap;
}

File 3 of 21 : ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT

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

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

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

    uint256 private _status;

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

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

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

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

        _;

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

File 4 of 21 : PausableUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

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

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    function __Pausable_init() internal initializer {
        __Context_init_unchained();
        __Pausable_init_unchained();
    }

    function __Pausable_init_unchained() internal initializer {
        _paused = false;
    }

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

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

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

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

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

File 5 of 21 : Initializable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

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

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        require(_initializing || !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }
}

File 6 of 21 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC20.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));
        }
    }

    /**
     * @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 7 of 21 : ERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless this function is
     * overridden;
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `recipient` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(_msgSender(), recipient, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * Requirements:
     *
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for ``sender``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);

        uint256 currentAllowance = _allowances[sender][_msgSender()];
        require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
        unchecked {
            _approve(sender, _msgSender(), currentAllowance - amount);
        }

        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        uint256 currentAllowance = _allowances[_msgSender()][spender];
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(_msgSender(), spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `sender` to `recipient`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `sender` cannot be the zero address.
     * - `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     */
    function _transfer(
        address sender,
        address recipient,
        uint256 amount
    ) internal virtual {
        require(sender != address(0), "ERC20: transfer from the zero address");
        require(recipient != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(sender, recipient, amount);

        uint256 senderBalance = _balances[sender];
        require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[sender] = senderBalance - amount;
        }
        _balances[recipient] += amount;

        emit Transfer(sender, recipient, amount);

        _afterTokenTransfer(sender, recipient, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
        }
        _totalSupply -= amount;

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}
}

File 8 of 21 : EnumerableSet.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

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

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

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

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

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

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

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

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

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

            return true;
        } else {
            return false;
        }
    }

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

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

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

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

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

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

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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

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

        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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

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

        assembly {
            result := store
        }

        return result;
    }
}

File 9 of 21 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

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

        (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

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 10 of 21 : SafeMath.sol
// SPDX-License-Identifier: MIT

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 no longer needed starting with Solidity 0.8. 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 substraction 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 11 of 21 : Math.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

// a library for performing various math operations

library Math {
    uint256 public constant WAD = 10**18;

    // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
    function sqrt(uint256 y) internal pure returns (uint256 z) {
        if (y > 3) {
            z = y;
            uint256 x = y / 2 + 1;
            while (x < z) {
                z = x;
                x = (y / x + x) / 2;
            }
        } else if (y != 0) {
            z = 1;
        }
    }

    //rounds to zero if x*y < WAD / 2
    function wmul(uint256 x, uint256 y) internal pure returns (uint256) {
        return ((x * y) + (WAD / 2)) / WAD;
    }
}

File 12 of 21 : IVePtp.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol';
import './IVeERC20.sol';

/**
 * @dev Interface of the VePtp
 */
interface IVePtp is IVeERC20, IERC721Receiver {
    function isUser(address _addr) external view returns (bool);

    function deposit(uint256 _amount) external;

    function claim() external;

    function withdraw(uint256 _amount) external;

    function unstakeNft() external;

    function getStakedNft(address _addr) external view returns (uint256);

    function getStakedPtp(address _addr) external view returns (uint256);

    function getVotes(address _account) external view returns (uint256);
}

File 13 of 21 : IPtp.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

interface IPtp {
    event Approval(address indexed owner, address indexed spender, uint256 value);
    event Transfer(address indexed from, address indexed to, uint256 value);

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

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

    function decimals() external pure returns (uint8);

    function totalSupply() external view returns (uint256);

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

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

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

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

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

    function DOMAIN_SEPARATOR() external view returns (bytes32);

    function PERMIT_TYPEHASH() external pure returns (bytes32);

    function nonces(address owner) external view returns (uint256);

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

File 14 of 21 : IMasterPlatypus.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

/**
 * @dev Interface of the MasterPlatypus
 */
interface IMasterPlatypus {
    function poolLength() external view returns (uint256);

    function pendingTokens(uint256 _pid, address _user)
        external
        view
        returns (
            uint256 pendingPtp,
            address bonusTokenAddress,
            string memory bonusTokenSymbol,
            uint256 pendingBonusToken
        );

    function rewarderBonusTokenInfo(uint256 _pid)
        external
        view
        returns (address bonusTokenAddress, string memory bonusTokenSymbol);

    function massUpdatePools() external;

    function updatePool(uint256 _pid) external;

    function deposit(uint256 _pid, uint256 _amount) external returns (uint256, uint256);

    function multiClaim(uint256[] memory _pids)
        external
        returns (
            uint256,
            uint256[] memory,
            uint256[] memory
        );

    function withdraw(uint256 _pid, uint256 _amount) external returns (uint256, uint256);

    function emergencyWithdraw(uint256 _pid) external;

    function migrate(uint256[] calldata _pids) external;

    function depositFor(
        uint256 _pid,
        uint256 _amount,
        address _user
    ) external;

    function updateFactor(address _user, uint256 _newVePtpBalance) external;
}

File 15 of 21 : IRewarder.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

import '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';

interface IRewarder {
    function onPtpReward(address user, uint256 newLpAmount) external returns (uint256);

    function pendingTokens(address user) external view returns (uint256 pending);

    function rewardToken() external view returns (IERC20Metadata);
}

File 16 of 21 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT

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

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

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

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
    uint256[50] private __gap;
}

File 17 of 21 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 18 of 21 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

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

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

File 19 of 21 : Context.sol
// SPDX-License-Identifier: MIT

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 20 of 21 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

File 21 of 21 : IVeERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

interface IVeERC20 {
    function totalSupply() external view returns (uint256);

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

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

Contract Security Audit

Contract ABI

API
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"allocPoint","type":"uint256"},{"indexed":true,"internalType":"contract IERC20","name":"lpToken","type":"address"},{"indexed":true,"internalType":"contract IRewarder","name":"rewarder","type":"address"}],"name":"Add","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","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":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"DepositFor","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EmergencyWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Harvest","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":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"allocPoint","type":"uint256"},{"indexed":true,"internalType":"contract IRewarder","name":"rewarder","type":"address"},{"indexed":false,"internalType":"bool","name":"overwrite","type":"bool"}],"name":"Set","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"ptpPerSec","type":"uint256"}],"name":"UpdateEmissionRate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"dialutingRepartition","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"nonDialutingRepartition","type":"uint256"}],"name":"UpdateEmissionRepartition","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lastRewardTimestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lpSupply","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"accPtpPerShare","type":"uint256"}],"name":"UpdatePool","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"address","name":"oldVePTP","type":"address"},{"indexed":false,"internalType":"address","name":"newVePTP","type":"address"}],"name":"UpdateVePTP","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[{"internalType":"uint256","name":"_allocPoint","type":"uint256"},{"internalType":"contract IERC20","name":"_lpToken","type":"address"},{"internalType":"contract IRewarder","name":"_rewarder","type":"address"}],"name":"add","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"claimablePtp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_user","type":"address"}],"name":"depositFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"dialutingRepartition","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emergencyPtpWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_ptp","type":"address"},{"internalType":"contract IVePtp","name":"_vePtp","type":"address"},{"internalType":"uint256","name":"_ptpPerSec","type":"uint256"},{"internalType":"uint256","name":"_dialutingRepartition","type":"uint256"},{"internalType":"uint256","name":"_startTimestamp","type":"uint256"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"massUpdatePools","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_pids","type":"uint256[]"}],"name":"migrate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_pids","type":"uint256[]"}],"name":"multiClaim","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"nonDialutingRepartition","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_user","type":"address"}],"name":"pendingTokens","outputs":[{"internalType":"uint256","name":"pendingPtp","type":"uint256"},{"internalType":"address","name":"bonusTokenAddress","type":"address"},{"internalType":"string","name":"bonusTokenSymbol","type":"string"},{"internalType":"uint256","name":"pendingBonusToken","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolInfo","outputs":[{"internalType":"contract IERC20","name":"lpToken","type":"address"},{"internalType":"uint256","name":"allocPoint","type":"uint256"},{"internalType":"uint256","name":"lastRewardTimestamp","type":"uint256"},{"internalType":"uint256","name":"accPtpPerShare","type":"uint256"},{"internalType":"contract IRewarder","name":"rewarder","type":"address"},{"internalType":"uint256","name":"sumOfFactors","type":"uint256"},{"internalType":"uint256","name":"accPtpPerFactorShare","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ptp","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ptpPerSec","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"rewarderBonusTokenInfo","outputs":[{"internalType":"address","name":"bonusTokenAddress","type":"address"},{"internalType":"string","name":"bonusTokenSymbol","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_allocPoint","type":"uint256"},{"internalType":"contract IRewarder","name":"_rewarder","type":"address"},{"internalType":"bool","name":"overwrite","type":"bool"}],"name":"set","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IMasterPlatypus","name":"_newMasterPlatypus","type":"address"}],"name":"setNewMasterPlatypus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IVePtp","name":"_newVePtp","type":"address"}],"name":"setVePtp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAllocPoint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_ptpPerSec","type":"uint256"}],"name":"updateEmissionRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_dialutingRepartition","type":"uint256"}],"name":"updateEmissionRepartition","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_newVePtpBalance","type":"uint256"}],"name":"updateFactor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"updatePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"userInfo","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"rewardDebt","type":"uint256"},{"internalType":"uint256","name":"factor","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vePtp","outputs":[{"internalType":"contract IVePtp","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b506143de806100206000396000f3fe608060405234801561001057600080fd5b506004361061025c5760003560e01c80638456cb5911610145578063bc70fdbc116100bd578063e2bbb1581161008c578063f2fde38b11610071578063f2fde38b1461056b578063f87bbc561461057e578063ffcd42631461058757600080fd5b8063e2bbb1581461054f578063e6fd48bc1461056257600080fd5b8063bc70fdbc146104f5578063d13f90b414610516578063d93bf4fe14610529578063e0a4ed431461053c57600080fd5b806390210d7e1161011457806393f1a40b116100f957806393f1a40b146104845780639702d3e2146104d9578063ab7de098146104e257600080fd5b806390210d7e1461045e57806390d9c1c31461047157600080fd5b80638456cb591461040757806388bba42f1461040f5780638b4d83a3146104225780638da5cb5b1461044d57600080fd5b806351eb05a6116101d85780636af66772116101a75780637b2615911161018c5780637b261591146103d95780637dd38dcc146103ec57806382c780a1146103f457600080fd5b80636af66772146103a6578063715018a6146103d157600080fd5b806351eb05a6146103625780635312ea8e146103755780635c975abb14610388578063630b5ba11461039e57600080fd5b806317caf6f11161022f578063441a3e7011610214578063441a3e70146103055780634ed73d281461032d5780634f00a93e1461034f57600080fd5b806317caf6f1146102f45780633f4ba83a146102fd57600080fd5b806305ed1de414610261578063081e3eda1461027d5780630ba84cd2146102855780631526fe271461029a575b600080fd5b61026a60cd5481565b6040519081526020015b60405180910390f35b60d15461026a565b610298610293366004613d54565b6105aa565b005b6102ad6102a8366004613d54565b61063d565b604080516001600160a01b03988916815260208101979097528601949094526060850192909252909316608083015260a082019290925260c081019190915260e001610274565b61026a60cf5481565b610298610698565b610318610313366004613d6d565b6106ea565b60408051928352602083019190915201610274565b61034061033b366004613dd6565b610b39565b60405161027493929190613eb7565b61029861035d366004613f01565b610bf7565b610298610370366004613d54565b610de9565b610298610383366004613d54565b610df5565b60975460ff166040519015158152602001610274565b610298610f17565b60c9546103b9906001600160a01b031681565b6040516001600160a01b039091168152602001610274565b610298610f42565b6102986103e7366004613f2d565b610f94565b610298610ffe565b60ca546103b9906001600160a01b031681565b6102986110da565b61029861041d366004613f58565b61112a565b61026a610430366004613fa2565b60d560209081526000928352604080842090915290825290205481565b6033546001600160a01b03166103b9565b61029861046c366004613fd2565b611337565b61029861047f366004613f2d565b611761565b6104be610492366004613fa2565b60d460209081526000928352604080842090915290825290208054600182015460029092015490919083565b60408051938452602084019290925290820152606001610274565b61026a60cc5481565b6102986104f036600461400b565b611827565b610508610503366004613d54565b611bc3565b60405161027492919061409a565b6102986105243660046140bc565b611d9e565b61029861053736600461410d565b612032565b61029861054a366004613d54565b6122e4565b61031861055d366004613d6d565b61239b565b61026a60d05481565b610298610579366004613f2d565b612736565b61026a60ce5481565b61059a610595366004613fa2565b612803565b6040516102749493929190614182565b6033546001600160a01b031633146105f75760405162461bcd60e51b8152602060048201819052602482015260008051602061438983398151915260448201526064015b60405180910390fd5b6105ff610f17565b60cc81905560405181815233907fe2492e003bbe8afa53088b406f0c1cb5d9e280370fc72a74cf116ffd343c4053906020015b60405180910390a250565b60d1818154811061064d57600080fd5b600091825260209091206007909102018054600182015460028301546003840154600485015460058601546006909601546001600160a01b0395861697509395929491939116919087565b6033546001600160a01b031633146106e05760405162461bcd60e51b8152602060048201819052602482015260008051602061438983398151915260448201526064016105ee565b6106e8612b01565b565b600080600260655414156107405760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105ee565b600260655560975460ff161561078b5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016105ee565b600060d185815481106107a0576107a06141bb565b6000918252602080832088845260d48252604080852033865290925292208054600790920290920192508511156108195760405162461bcd60e51b815260206004820152601260248201527f77697468647261773a206e6f7420676f6f64000000000000000000000000000060448201526064016105ee565b61082286612b9d565b6001810154600087815260d5602090815260408083203384529091528120546006850154600285015492939264e8d4a510009161085e916141e7565b6003870154865461086f91906141e7565b6108799190614206565b610883919061421e565b61088d9190614206565b6108979190614240565b600088815260d5602090815260408083203380855292528220919091559091506108c19082612da0565b905086336001600160a01b03167f71bab65ced2e5750775a0613be067df48ef06cf92a496ebf7663ae0660924954836040516108ff91815260200190565b60405180910390a360028201548254610919908890614240565b835560ca546040516370a0823160e01b81523360048201526109aa916001600160a01b0316906370a08231906024015b60206040518083038186803b15801561096157600080fd5b505afa158015610975573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109999190614257565b84546109a591906141e7565b612f9a565b60028401819055600585015482916109c191614206565b6109cb9190614240565b60058501556006840154600284015464e8d4a51000916109ea916141e7565b600386015485546109fb91906141e7565b610a059190614206565b610a0f919061421e565b8360010181905550600060d18981548110610a2c57610a2c6141bb565b600091825260208220600460079092020101546001600160a01b031691508115610ad6578454604051637135edff60e11b815233600482015260248101919091526001600160a01b0383169063e26bdbfe90604401602060405180830381600087803b158015610a9b57600080fd5b505af1158015610aaf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ad39190614257565b90505b8554610aec906001600160a01b0316338b61300a565b6040518981528a9033907ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b568906020015b60405180910390a360016065559299929850919650505050505050565b600060608060026065541415610b915760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105ee565b600260655560975460ff1615610bdc5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016105ee565b610be58461309f565b92509250925060016065559193909250565b60ca546001600160a01b03163314610c515760405162461bcd60e51b815260206004820152600e60248201527f6e6f7456655074703a207775743f00000000000000000000000000000000000060448201526064016105ee565b60d15460005b81811015610de357600081815260d4602090815260408083206001600160a01b038816845290915290208054610c8d5750610dd3565b600060d18381548110610ca257610ca26141bb565b90600052602060002090600702019050610cbb83612b9d565b6000826001015464e8d4a5100083600601548560020154610cdc91906141e7565b60038501548654610ced91906141e7565b610cf79190614206565b610d01919061421e565b610d0b9190614240565b600085815260d5602090815260408083206001600160a01b038c168452909152812080549293508392909190610d42908490614206565b909155505060028301548354600090610d5f906109a5908a6141e7565b60028601819055600685015490915064e8d4a5100090610d7f90836141e7565b60038601548754610d9091906141e7565b610d9a9190614206565b610da4919061421e565b600186015560058401548290610dbb908390614206565b610dc59190614240565b846005018190555050505050505b610ddc81614270565b9050610c57565b50505050565b610df281612b9d565b50565b60026065541415610e485760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105ee565b6002606581905550600060d18281548110610e6557610e656141bb565b6000918252602080832085845260d482526040808520338087529352909320805460079093029093018054909450610eaa926001600160a01b0391909116919061300a565b80600201548260050154610ebe9190614240565b600583015560006002820181905580825560018201819055604051908152839033907fbb757047c2b5f3974fe26b7c10f732e7bce710b0952a71082702781e62ae05959060200160405180910390a35050600160655550565b60d15460005b81811015610f3e57610f2e81612b9d565b610f3781614270565b9050610f1d565b5050565b6033546001600160a01b03163314610f8a5760405162461bcd60e51b8152602060048201819052602482015260008051602061438983398151915260448201526064016105ee565b6106e860006135ac565b6033546001600160a01b03163314610fdc5760405162461bcd60e51b8152602060048201819052602482015260008051602061438983398151915260448201526064016105ee565b60cb80546001600160a01b0319166001600160a01b0392909216919091179055565b6033546001600160a01b031633146110465760405162461bcd60e51b8152602060048201819052602482015260008051602061438983398151915260448201526064016105ee565b60c9546040516370a0823160e01b81523060048201526106e89133916001600160a01b03909116906370a082319060240160206040518083038186803b15801561108f57600080fd5b505afa1580156110a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110c79190614257565b60c9546001600160a01b0316919061300a565b6033546001600160a01b031633146111225760405162461bcd60e51b8152602060048201819052602482015260008051602061438983398151915260448201526064016105ee565b6106e86135fe565b6033546001600160a01b031633146111725760405162461bcd60e51b8152602060048201819052602482015260008051602061438983398151915260448201526064016105ee565b813b15158061118857506001600160a01b038216155b6111e35760405162461bcd60e51b815260206004820152602660248201527f7365743a207265776172646572206d75737420626520636f6e7472616374206f60448201526572207a65726f60d01b60648201526084016105ee565b6111eb610f17565b8260d185815481106111ff576111ff6141bb565b90600052602060002090600702016001015460cf5461121e9190614240565b6112289190614206565b60cf819055508260d18581548110611242576112426141bb565b90600052602060002090600702016001018190555080156112a7578160d18581548110611271576112716141bb565b906000526020600020906007020160040160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b806112e15760d184815481106112bf576112bf6141bb565b60009182526020909120600460079092020101546001600160a01b03166112e3565b815b6001600160a01b0316847fa54644aae5c48c5971516f334e4fe8ecbc7930e23f34877d4203c6551e67ffaa85846040516113299291909182521515602082015260400190565b60405180910390a350505050565b6002606554141561138a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105ee565b6002606555326001600160a01b038216146113e75760405162461bcd60e51b815260206004820152601060248201527f6465706f736974466f723a207775743f0000000000000000000000000000000060448201526064016105ee565b600060d184815481106113fc576113fc6141bb565b6000918252602080832087845260d4825260408085206001600160a01b038816865290925292206007909102909101915061143685612b9d565b805415611520576001810154600086815260d5602090815260408083203384529091528120546006850154600285015492939264e8d4a5100091611479916141e7565b6003870154865461148a91906141e7565b6114949190614206565b61149e919061421e565b6114a89190614206565b6114b29190614240565b600087815260d56020908152604080832033845290915281205590506114d88482612da0565b905085846001600160a01b03167f71bab65ced2e5750775a0613be067df48ef06cf92a496ebf7663ae06609249548360405161151691815260200190565b60405180910390a3505b838160000160008282546115349190614206565b9091555050600281015460ca546040516370a0823160e01b81526001600160a01b0386811660048301526115c99216906370a082319060240160206040518083038186803b15801561158557600080fd5b505afa158015611599573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115bd9190614257565b83546109a591906141e7565b60028301819055600584015482916115e091614206565b6115ea9190614240565b60058401556006830154600283015464e8d4a5100091611609916141e7565b6003850154845461161a91906141e7565b6116249190614206565b61162e919061421e565b8260010181905550600060d1878154811061164b5761164b6141bb565b60009182526020909120600460079092020101546001600160a01b0316905080156116f8578254604051637135edff60e11b81526001600160a01b03878116600483015260248201929092529082169063e26bdbfe90604401602060405180830381600087803b1580156116be57600080fd5b505af11580156116d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116f69190614257565b505b835461170f906001600160a01b0316333089613679565b86856001600160a01b03167f16f3fbfd4bcc50a5cecb2e53e398a1ad77d89f63288ef540d862b264ed57eb1f8860405161174b91815260200190565b60405180910390a3505060016065555050505050565b6033546001600160a01b031633146117a95760405162461bcd60e51b8152602060048201819052602482015260008051602061438983398151915260448201526064016105ee565b6001600160a01b0381166117bc57600080fd5b6117c4610f17565b60ca80546001600160a01b038381166001600160a01b0319831681179093556040805191909216808252602082019390935233917fcdc066eb512c135b027caebc803aa836c938e3e26bb2756b395da32ce0139e47910160405180910390a25050565b6033546001600160a01b0316331461186f5760405162461bcd60e51b8152602060048201819052602482015260008051602061438983398151915260448201526064016105ee565b813b6118e35760405162461bcd60e51b815260206004820152602660248201527f6164643a204c5020746f6b656e206d75737420626520612076616c696420636f60448201527f6e7472616374000000000000000000000000000000000000000000000000000060648201526084016105ee565b803b1515806118f957506001600160a01b038116155b6119545760405162461bcd60e51b815260206004820152602660248201527f6164643a207265776172646572206d75737420626520636f6e7472616374206f60448201526572207a65726f60d01b60648201526084016105ee565b61195f60d2836136ca565b156119ac5760405162461bcd60e51b815260206004820152601560248201527f6164643a204c5020616c7265616479206164646564000000000000000000000060448201526064016105ee565b6119b4610f17565b600060d05442116119c75760d0546119c9565b425b90508360cf546119d99190614206565b60cf556040805160e0810182526001600160a01b038086168252602082018781529282018481526000606084018181528784166080860190815260a0860183815260c0870184815260d180546001810182559552965160079094027f695fb3134ad82c3b8022bc5464edd0bcc9424ef672b52245dcb6ab2374327ce3810180549588166001600160a01b031996871617905597517f695fb3134ad82c3b8022bc5464edd0bcc9424ef672b52245dcb6ab2374327ce489015593517f695fb3134ad82c3b8022bc5464edd0bcc9424ef672b52245dcb6ab2374327ce588015590517f695fb3134ad82c3b8022bc5464edd0bcc9424ef672b52245dcb6ab2374327ce6870155517f695fb3134ad82c3b8022bc5464edd0bcc9424ef672b52245dcb6ab2374327ce78601805491909416911617909155517f695fb3134ad82c3b8022bc5464edd0bcc9424ef672b52245dcb6ab2374327ce8830155517f695fb3134ad82c3b8022bc5464edd0bcc9424ef672b52245dcb6ab2374327ce990910155611b6360d2846136ef565b50816001600160a01b0316836001600160a01b0316600160d180549050611b8a9190614240565b6040518781527f4b16bd2431ad24dc020ab0e1de7fcb6563dead6a24fb10089d6c23e97a70381f9060200160405180910390a450505050565b60006060600060d18481548110611bdc57611bdc6141bb565b6000918252602090912060079091020160048101549091506001600160a01b031615611d9857600480820154604080517ff7c618c100000000000000000000000000000000000000000000000000000000815290516001600160a01b039092169263f7c618c1928282019260209290829003018186803b158015611c5f57600080fd5b505afa158015611c73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c97919061428b565b92508060040160009054906101000a90046001600160a01b03166001600160a01b031663f7c618c16040518163ffffffff1660e01b815260040160206040518083038186803b158015611ce957600080fd5b505afa158015611cfd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d21919061428b565b6001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b158015611d5957600080fd5b505afa158015611d6d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611d9591908101906142a8565b91505b50915091565b600054610100900460ff1680611db7575060005460ff16155b611e1a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016105ee565b600054610100900460ff16158015611e3c576000805461ffff19166101011790555b6001600160a01b038616611e925760405162461bcd60e51b815260206004820152601a60248201527f70747020616464726573732063616e6e6f74206265207a65726f00000000000060448201526064016105ee565b6001600160a01b038516611ee85760405162461bcd60e51b815260206004820152601c60248201527f766550747020616464726573732063616e6e6f74206265207a65726f0000000060448201526064016105ee565b83611f355760405162461bcd60e51b815260206004820152601a60248201527f70747020706572207365632063616e6e6f74206265207a65726f00000000000060448201526064016105ee565b6103e8831115611fad5760405162461bcd60e51b815260206004820152602e60248201527f6469616c7574696e67207265706172746974696f6e206d75737420626520696e60448201527f2072616e676520302c203130303000000000000000000000000000000000000060648201526084016105ee565b611fb5613704565b611fbd6137c6565b611fc561387d565b60c980546001600160a01b038089166001600160a01b03199283161790925560ca80549288169290911691909117905560cc84905560cd83905561200b836103e8614240565b60ce5560d0829055600060cf55801561202a576000805461ff00191690555b505050505050565b600260655414156120855760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105ee565b600260655560cb546001600160a01b03166120e25760405162461bcd60e51b815260206004820152600960248201527f746f2077686572653f000000000000000000000000000000000000000000000060448201526064016105ee565b61211e82828080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061309f92505050565b50505060005b818110156122da576000838383818110612140576121406141bb565b60209081029290920135600081815260d484526040808220338352909452929092208054929350911590506122c757600060d18381548110612184576121846141bb565b60009182526020909120600790910201805460cb5484546040517f095ea7b30000000000000000000000000000000000000000000000000000000081526001600160a01b0392831660048201526024810191909152929350169063095ea7b390604401602060405180830381600087803b15801561220157600080fd5b505af1158015612215573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612239919061433c565b5060cb5482546040517f90210d7e0000000000000000000000000000000000000000000000000000000081526004810186905260248101919091523360448201526001600160a01b03909116906390210d7e90606401600060405180830381600087803b1580156122a957600080fd5b505af11580156122bd573d6000803e3d6000fd5b5050600084555050505b5050806122d390614270565b9050612124565b5050600160655550565b6033546001600160a01b0316331461232c5760405162461bcd60e51b8152602060048201819052602482015260008051602061438983398151915260448201526064016105ee565b6103e881111561233b57600080fd5b612343610f17565b60cd819055612354816103e8614240565b60ce55337fb24c3afbe477581b073ec4a6f19df34024e917cee6bb519129629defa718f63082612386816103e8614240565b60408051928352602083019190915201610632565b600080600260655414156123f15760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105ee565b600260655560975460ff161561243c5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016105ee565b600060d18581548110612451576124516141bb565b6000918252602080832088845260d48252604080852033865290925292206007909102909101915061248286612b9d565b80546000901561256f576001820154600088815260d5602090815260408083203384529091529020546006850154600285015464e8d4a51000916124c5916141e7565b600387015486546124d691906141e7565b6124e09190614206565b6124ea919061421e565b6124f49190614206565b6124fe9190614240565b600088815260d5602090815260408083203380855292528220919091559091506125289082612da0565b905086336001600160a01b03167f71bab65ced2e5750775a0613be067df48ef06cf92a496ebf7663ae06609249548360405161256691815260200190565b60405180910390a35b858260000160008282546125839190614206565b9091555050600282015460ca546040516370a0823160e01b81523360048201526125bf916001600160a01b0316906370a0823190602401610949565b60028401819055600585015482916125d691614206565b6125e09190614240565b60058501556006840154600284015464e8d4a51000916125ff916141e7565b6003860154855461261091906141e7565b61261a9190614206565b612624919061421e565b8360010181905550600060d18981548110612641576126416141bb565b600091825260208220600460079092020101546001600160a01b0316915081156126eb578454604051637135edff60e11b815233600482015260248101919091526001600160a01b0383169063e26bdbfe90604401602060405180830381600087803b1580156126b057600080fd5b505af11580156126c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126e89190614257565b90505b8554612702906001600160a01b031633308c613679565b6040518981528a9033907f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a1590602001610b1c565b6033546001600160a01b0316331461277e5760405162461bcd60e51b8152602060048201819052602482015260008051602061438983398151915260448201526064016105ee565b6001600160a01b0381166127fa5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016105ee565b610df2816135ac565b600080606060008060d1878154811061281e5761281e6141bb565b600091825260208083208a845260d4825260408085206001600160a01b038c81168752935280852060079490940290910160038101546006820154825493516370a0823160e01b81523060048201529297509495909493909216906370a082319060240160206040518083038186803b15801561289a57600080fd5b505afa1580156128ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128d29190614257565b90508460020154421180156128e657508015155b156129be5760008560020154426128fd9190614240565b9050600060cf54876001015460cc548461291791906141e7565b61292191906141e7565b61292b919061421e565b9050612939836103e86141e7565b60cd5461294b8364e8d4a510006141e7565b61295591906141e7565b61295f919061421e565b6129699086614206565b945086600501546000146129bb576005870154612988906103e86141e7565b60ce5461299a8364e8d4a510006141e7565b6129a491906141e7565b6129ae919061421e565b6129b89085614206565b93505b50505b600184015460008c815260d5602090815260408083206001600160a01b038f168452909152902054600286015464e8d4a51000906129fd9086906141e7565b8754612a0a9088906141e7565b612a149190614206565b612a1e919061421e565b612a289190614206565b612a329190614240565b60048601549099506001600160a01b031615612af357612a518b611bc3565b6004878101546040517fc031a66f0000000000000000000000000000000000000000000000000000000081526001600160a01b038f811693820193909352939b50919950169063c031a66f9060240160206040518083038186803b158015612ab857600080fd5b505afa158015612acc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612af09190614257565b95505b505050505092959194509250565b60975460ff16612b535760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f742070617573656400000000000000000000000060448201526064016105ee565b6097805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600060d18281548110612bb257612bb26141bb565b906000526020600020906007020190508060020154421115610f3e5780546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b158015612c1157600080fd5b505afa158015612c25573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c499190614257565b905080612c5b57504260029091015550565b6000826002015442612c6d9190614240565b9050600060cf54846001015460cc5484612c8791906141e7565b612c9191906141e7565b612c9b919061421e565b9050612ca9836103e86141e7565b60cd54612cbb8364e8d4a510006141e7565b612cc591906141e7565b612ccf919061421e565b846003016000828254612ce29190614206565b90915550506005840154612cfc5760006006850155612d4c565b6005840154612d0d906103e86141e7565b60ce54612d1f8364e8d4a510006141e7565b612d2991906141e7565b612d33919061421e565b846006016000828254612d469190614206565b90915550505b42600285018190556003850154604080519283526020830186905282015285907f3be3541fc42237d611b30329040bfa4569541d156560acdbbae57640d20b8f469060600160405180910390a25050505050565b60c9546040516370a0823160e01b815230600482015260009182916001600160a01b03909116906370a082319060240160206040518083038186803b158015612de857600080fd5b505afa158015612dfc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e209190614257565b905060008111612e725760405162461bcd60e51b815260206004820152601760248201527f4e6f20746f6b656e7320746f206469737472696275746500000000000000000060448201526064016105ee565b80831115612f085760c95460405163a9059cbb60e01b81526001600160a01b038681166004830152602482018490529091169063a9059cbb90604401602060405180830381600087803b158015612ec857600080fd5b505af1158015612edc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f00919061433c565b509050612f94565b60c95460405163a9059cbb60e01b81526001600160a01b038681166004830152602482018690529091169063a9059cbb90604401602060405180830381600087803b158015612f5657600080fd5b505af1158015612f6a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f8e919061433c565b50829150505b92915050565b60006003821115612ffb5750806000612fb460028361421e565b612fbf906001614206565b90505b81811015612ff557905080600281612fda818661421e565b612fe49190614206565b612fee919061421e565b9050612fc2565b50919050565b8115613005575060015b919050565b6040516001600160a01b03831660248201526044810182905261309a90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152613939565b505050565b6000606080600080855167ffffffffffffffff8111156130c1576130c1613d8f565b6040519080825280602002602001820160405280156130ea578160200160208202803683370190505b5090506000865167ffffffffffffffff81111561310957613109613d8f565b604051908082528060200260200182016040528015613132578160200160208202803683370190505b50905060005b875181101561341057613163888281518110613156576131566141bb565b6020026020010151612b9d565b600060d1898381518110613179576131796141bb565b602002602001015181548110613191576131916141bb565b90600052602060002090600702019050600060d460008b85815181106131b9576131b96141bb565b6020908102919091018101518252818101929092526040908101600090812033825290925290208054909150156133fd576000816001015460d560008d8781518110613207576132076141bb565b602002602001015181526020019081526020016000206000336001600160a01b03166001600160a01b031681526020019081526020016000205464e8d4a510008560060154856002015461325b91906141e7565b6003870154865461326c91906141e7565b6132769190614206565b613280919061421e565b61328a9190614206565b6132949190614240565b9050600060d560008d87815181106132ae576132ae6141bb565b602090810291909101810151825281810192909252604090810160009081203382529092529020556006830154600283015464e8d4a51000916132f0916141e7565b6003850154845461330191906141e7565b61330b9190614206565b613315919061421e565b60018301556133248188614206565b965080868581518110613339576133396141bb565b602090810291909101015260048301546001600160a01b031680156133fa578254604051637135edff60e11b815233600482015260248101919091526001600160a01b0382169063e26bdbfe90604401602060405180830381600087803b1580156133a357600080fd5b505af11580156133b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133db9190614257565b8686815181106133ed576133ed6141bb565b6020026020010181815250505b50505b50508061340990614270565b9050613138565b50600061341d3385612da0565b905083811461350c5760005b88518110156135065784848281518110613445576134456141bb565b60200260200101518361345891906141e7565b613462919061421e565b848281518110613474576134746141bb565b602002602001018181525050888181518110613492576134926141bb565b6020026020010151336001600160a01b03167f71bab65ced2e5750775a0613be067df48ef06cf92a496ebf7663ae06609249548684815181106134d7576134d76141bb565b60200260200101516040516134ee91815260200190565b60405180910390a36134ff81614270565b9050613429565b506135a0565b60005b885181101561359e5788818151811061352a5761352a6141bb565b6020026020010151336001600160a01b03167f71bab65ced2e5750775a0613be067df48ef06cf92a496ebf7663ae066092495486848151811061356f5761356f6141bb565b602002602001015160405161358691815260200190565b60405180910390a361359781614270565b905061350f565b505b97919650945092505050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60975460ff16156136445760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016105ee565b6097805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258612b803390565b6040516001600160a01b0380851660248301528316604482015260648101829052610de39085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401613036565b6001600160a01b038116600090815260018301602052604081205415155b9392505050565b60006136e8836001600160a01b038416613a1e565b600054610100900460ff168061371d575060005460ff16155b6137805760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016105ee565b600054610100900460ff161580156137a2576000805461ffff19166101011790555b6137aa613a6d565b6137b2613b1e565b8015610df2576000805461ff001916905550565b600054610100900460ff16806137df575060005460ff16155b6138425760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016105ee565b600054610100900460ff16158015613864576000805461ffff19166101011790555b60016065558015610df2576000805461ff001916905550565b600054610100900460ff1680613896575060005460ff16155b6138f95760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016105ee565b600054610100900460ff1615801561391b576000805461ffff19166101011790555b6097805460ff191690558015610df2576000805461ff001916905550565b600061398e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613bc59092919063ffffffff16565b80519091501561309a57808060200190518101906139ac919061433c565b61309a5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016105ee565b6000818152600183016020526040812054613a6557508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155612f94565b506000612f94565b600054610100900460ff1680613a86575060005460ff16155b613ae95760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016105ee565b600054610100900460ff161580156137b2576000805461ffff19166101011790558015610df2576000805461ff001916905550565b600054610100900460ff1680613b37575060005460ff16155b613b9a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016105ee565b600054610100900460ff16158015613bbc576000805461ffff19166101011790555b6137b2336135ac565b6060613bd48484600085613bdc565b949350505050565b606082471015613c545760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016105ee565b843b613ca25760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016105ee565b600080866001600160a01b03168587604051613cbe9190614359565b60006040518083038185875af1925050503d8060008114613cfb576040519150601f19603f3d011682016040523d82523d6000602084013e613d00565b606091505b5091509150613d10828286613d1b565b979650505050505050565b60608315613d2a5750816136e8565b825115613d3a5782518084602001fd5b8160405162461bcd60e51b81526004016105ee9190614375565b600060208284031215613d6657600080fd5b5035919050565b60008060408385031215613d8057600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613dce57613dce613d8f565b604052919050565b60006020808385031215613de957600080fd5b823567ffffffffffffffff80821115613e0157600080fd5b818501915085601f830112613e1557600080fd5b813581811115613e2757613e27613d8f565b8060051b9150613e38848301613da5565b8181529183018401918481019088841115613e5257600080fd5b938501935b83851015613e7057843582529385019390850190613e57565b98975050505050505050565b600081518084526020808501945080840160005b83811015613eac57815187529582019590820190600101613e90565b509495945050505050565b838152606060208201526000613ed06060830185613e7c565b8281036040840152613ee28185613e7c565b9695505050505050565b6001600160a01b0381168114610df257600080fd5b60008060408385031215613f1457600080fd5b8235613f1f81613eec565b946020939093013593505050565b600060208284031215613f3f57600080fd5b81356136e881613eec565b8015158114610df257600080fd5b60008060008060808587031215613f6e57600080fd5b84359350602085013592506040850135613f8781613eec565b91506060850135613f9781613f4a565b939692955090935050565b60008060408385031215613fb557600080fd5b823591506020830135613fc781613eec565b809150509250929050565b600080600060608486031215613fe757600080fd5b8335925060208401359150604084013561400081613eec565b809150509250925092565b60008060006060848603121561402057600080fd5b83359250602084013561403281613eec565b9150604084013561400081613eec565b60005b8381101561405d578181015183820152602001614045565b83811115610de35750506000910152565b60008151808452614086816020860160208601614042565b601f01601f19169290920160200192915050565b6001600160a01b0383168152604060208201526000613bd4604083018461406e565b600080600080600060a086880312156140d457600080fd5b85356140df81613eec565b945060208601356140ef81613eec565b94979496505050506040830135926060810135926080909101359150565b6000806020838503121561412057600080fd5b823567ffffffffffffffff8082111561413857600080fd5b818501915085601f83011261414c57600080fd5b81358181111561415b57600080fd5b8660208260051b850101111561417057600080fd5b60209290920196919550909350505050565b8481526001600160a01b03841660208201526080604082015260006141aa608083018561406e565b905082606083015295945050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615614201576142016141d1565b500290565b60008219821115614219576142196141d1565b500190565b60008261423b57634e487b7160e01b600052601260045260246000fd5b500490565b600082821015614252576142526141d1565b500390565b60006020828403121561426957600080fd5b5051919050565b6000600019821415614284576142846141d1565b5060010190565b60006020828403121561429d57600080fd5b81516136e881613eec565b6000602082840312156142ba57600080fd5b815167ffffffffffffffff808211156142d257600080fd5b818401915084601f8301126142e657600080fd5b8151818111156142f8576142f8613d8f565b61430b601f8201601f1916602001613da5565b915080825285602082850101111561432257600080fd5b614333816020840160208601614042565b50949350505050565b60006020828403121561434e57600080fd5b81516136e881613f4a565b6000825161436b818460208701614042565b9190910192915050565b6020815260006136e8602083018461406e56fe4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a26469706673582212202c520007f80e8c70cc5baf558f99d65d461743cfa05d2df21e7d1e8f6ff2448664736f6c63430008090033

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061025c5760003560e01c80638456cb5911610145578063bc70fdbc116100bd578063e2bbb1581161008c578063f2fde38b11610071578063f2fde38b1461056b578063f87bbc561461057e578063ffcd42631461058757600080fd5b8063e2bbb1581461054f578063e6fd48bc1461056257600080fd5b8063bc70fdbc146104f5578063d13f90b414610516578063d93bf4fe14610529578063e0a4ed431461053c57600080fd5b806390210d7e1161011457806393f1a40b116100f957806393f1a40b146104845780639702d3e2146104d9578063ab7de098146104e257600080fd5b806390210d7e1461045e57806390d9c1c31461047157600080fd5b80638456cb591461040757806388bba42f1461040f5780638b4d83a3146104225780638da5cb5b1461044d57600080fd5b806351eb05a6116101d85780636af66772116101a75780637b2615911161018c5780637b261591146103d95780637dd38dcc146103ec57806382c780a1146103f457600080fd5b80636af66772146103a6578063715018a6146103d157600080fd5b806351eb05a6146103625780635312ea8e146103755780635c975abb14610388578063630b5ba11461039e57600080fd5b806317caf6f11161022f578063441a3e7011610214578063441a3e70146103055780634ed73d281461032d5780634f00a93e1461034f57600080fd5b806317caf6f1146102f45780633f4ba83a146102fd57600080fd5b806305ed1de414610261578063081e3eda1461027d5780630ba84cd2146102855780631526fe271461029a575b600080fd5b61026a60cd5481565b6040519081526020015b60405180910390f35b60d15461026a565b610298610293366004613d54565b6105aa565b005b6102ad6102a8366004613d54565b61063d565b604080516001600160a01b03988916815260208101979097528601949094526060850192909252909316608083015260a082019290925260c081019190915260e001610274565b61026a60cf5481565b610298610698565b610318610313366004613d6d565b6106ea565b60408051928352602083019190915201610274565b61034061033b366004613dd6565b610b39565b60405161027493929190613eb7565b61029861035d366004613f01565b610bf7565b610298610370366004613d54565b610de9565b610298610383366004613d54565b610df5565b60975460ff166040519015158152602001610274565b610298610f17565b60c9546103b9906001600160a01b031681565b6040516001600160a01b039091168152602001610274565b610298610f42565b6102986103e7366004613f2d565b610f94565b610298610ffe565b60ca546103b9906001600160a01b031681565b6102986110da565b61029861041d366004613f58565b61112a565b61026a610430366004613fa2565b60d560209081526000928352604080842090915290825290205481565b6033546001600160a01b03166103b9565b61029861046c366004613fd2565b611337565b61029861047f366004613f2d565b611761565b6104be610492366004613fa2565b60d460209081526000928352604080842090915290825290208054600182015460029092015490919083565b60408051938452602084019290925290820152606001610274565b61026a60cc5481565b6102986104f036600461400b565b611827565b610508610503366004613d54565b611bc3565b60405161027492919061409a565b6102986105243660046140bc565b611d9e565b61029861053736600461410d565b612032565b61029861054a366004613d54565b6122e4565b61031861055d366004613d6d565b61239b565b61026a60d05481565b610298610579366004613f2d565b612736565b61026a60ce5481565b61059a610595366004613fa2565b612803565b6040516102749493929190614182565b6033546001600160a01b031633146105f75760405162461bcd60e51b8152602060048201819052602482015260008051602061438983398151915260448201526064015b60405180910390fd5b6105ff610f17565b60cc81905560405181815233907fe2492e003bbe8afa53088b406f0c1cb5d9e280370fc72a74cf116ffd343c4053906020015b60405180910390a250565b60d1818154811061064d57600080fd5b600091825260209091206007909102018054600182015460028301546003840154600485015460058601546006909601546001600160a01b0395861697509395929491939116919087565b6033546001600160a01b031633146106e05760405162461bcd60e51b8152602060048201819052602482015260008051602061438983398151915260448201526064016105ee565b6106e8612b01565b565b600080600260655414156107405760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105ee565b600260655560975460ff161561078b5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016105ee565b600060d185815481106107a0576107a06141bb565b6000918252602080832088845260d48252604080852033865290925292208054600790920290920192508511156108195760405162461bcd60e51b815260206004820152601260248201527f77697468647261773a206e6f7420676f6f64000000000000000000000000000060448201526064016105ee565b61082286612b9d565b6001810154600087815260d5602090815260408083203384529091528120546006850154600285015492939264e8d4a510009161085e916141e7565b6003870154865461086f91906141e7565b6108799190614206565b610883919061421e565b61088d9190614206565b6108979190614240565b600088815260d5602090815260408083203380855292528220919091559091506108c19082612da0565b905086336001600160a01b03167f71bab65ced2e5750775a0613be067df48ef06cf92a496ebf7663ae0660924954836040516108ff91815260200190565b60405180910390a360028201548254610919908890614240565b835560ca546040516370a0823160e01b81523360048201526109aa916001600160a01b0316906370a08231906024015b60206040518083038186803b15801561096157600080fd5b505afa158015610975573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109999190614257565b84546109a591906141e7565b612f9a565b60028401819055600585015482916109c191614206565b6109cb9190614240565b60058501556006840154600284015464e8d4a51000916109ea916141e7565b600386015485546109fb91906141e7565b610a059190614206565b610a0f919061421e565b8360010181905550600060d18981548110610a2c57610a2c6141bb565b600091825260208220600460079092020101546001600160a01b031691508115610ad6578454604051637135edff60e11b815233600482015260248101919091526001600160a01b0383169063e26bdbfe90604401602060405180830381600087803b158015610a9b57600080fd5b505af1158015610aaf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ad39190614257565b90505b8554610aec906001600160a01b0316338b61300a565b6040518981528a9033907ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b568906020015b60405180910390a360016065559299929850919650505050505050565b600060608060026065541415610b915760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105ee565b600260655560975460ff1615610bdc5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016105ee565b610be58461309f565b92509250925060016065559193909250565b60ca546001600160a01b03163314610c515760405162461bcd60e51b815260206004820152600e60248201527f6e6f7456655074703a207775743f00000000000000000000000000000000000060448201526064016105ee565b60d15460005b81811015610de357600081815260d4602090815260408083206001600160a01b038816845290915290208054610c8d5750610dd3565b600060d18381548110610ca257610ca26141bb565b90600052602060002090600702019050610cbb83612b9d565b6000826001015464e8d4a5100083600601548560020154610cdc91906141e7565b60038501548654610ced91906141e7565b610cf79190614206565b610d01919061421e565b610d0b9190614240565b600085815260d5602090815260408083206001600160a01b038c168452909152812080549293508392909190610d42908490614206565b909155505060028301548354600090610d5f906109a5908a6141e7565b60028601819055600685015490915064e8d4a5100090610d7f90836141e7565b60038601548754610d9091906141e7565b610d9a9190614206565b610da4919061421e565b600186015560058401548290610dbb908390614206565b610dc59190614240565b846005018190555050505050505b610ddc81614270565b9050610c57565b50505050565b610df281612b9d565b50565b60026065541415610e485760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105ee565b6002606581905550600060d18281548110610e6557610e656141bb565b6000918252602080832085845260d482526040808520338087529352909320805460079093029093018054909450610eaa926001600160a01b0391909116919061300a565b80600201548260050154610ebe9190614240565b600583015560006002820181905580825560018201819055604051908152839033907fbb757047c2b5f3974fe26b7c10f732e7bce710b0952a71082702781e62ae05959060200160405180910390a35050600160655550565b60d15460005b81811015610f3e57610f2e81612b9d565b610f3781614270565b9050610f1d565b5050565b6033546001600160a01b03163314610f8a5760405162461bcd60e51b8152602060048201819052602482015260008051602061438983398151915260448201526064016105ee565b6106e860006135ac565b6033546001600160a01b03163314610fdc5760405162461bcd60e51b8152602060048201819052602482015260008051602061438983398151915260448201526064016105ee565b60cb80546001600160a01b0319166001600160a01b0392909216919091179055565b6033546001600160a01b031633146110465760405162461bcd60e51b8152602060048201819052602482015260008051602061438983398151915260448201526064016105ee565b60c9546040516370a0823160e01b81523060048201526106e89133916001600160a01b03909116906370a082319060240160206040518083038186803b15801561108f57600080fd5b505afa1580156110a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110c79190614257565b60c9546001600160a01b0316919061300a565b6033546001600160a01b031633146111225760405162461bcd60e51b8152602060048201819052602482015260008051602061438983398151915260448201526064016105ee565b6106e86135fe565b6033546001600160a01b031633146111725760405162461bcd60e51b8152602060048201819052602482015260008051602061438983398151915260448201526064016105ee565b813b15158061118857506001600160a01b038216155b6111e35760405162461bcd60e51b815260206004820152602660248201527f7365743a207265776172646572206d75737420626520636f6e7472616374206f60448201526572207a65726f60d01b60648201526084016105ee565b6111eb610f17565b8260d185815481106111ff576111ff6141bb565b90600052602060002090600702016001015460cf5461121e9190614240565b6112289190614206565b60cf819055508260d18581548110611242576112426141bb565b90600052602060002090600702016001018190555080156112a7578160d18581548110611271576112716141bb565b906000526020600020906007020160040160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b806112e15760d184815481106112bf576112bf6141bb565b60009182526020909120600460079092020101546001600160a01b03166112e3565b815b6001600160a01b0316847fa54644aae5c48c5971516f334e4fe8ecbc7930e23f34877d4203c6551e67ffaa85846040516113299291909182521515602082015260400190565b60405180910390a350505050565b6002606554141561138a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105ee565b6002606555326001600160a01b038216146113e75760405162461bcd60e51b815260206004820152601060248201527f6465706f736974466f723a207775743f0000000000000000000000000000000060448201526064016105ee565b600060d184815481106113fc576113fc6141bb565b6000918252602080832087845260d4825260408085206001600160a01b038816865290925292206007909102909101915061143685612b9d565b805415611520576001810154600086815260d5602090815260408083203384529091528120546006850154600285015492939264e8d4a5100091611479916141e7565b6003870154865461148a91906141e7565b6114949190614206565b61149e919061421e565b6114a89190614206565b6114b29190614240565b600087815260d56020908152604080832033845290915281205590506114d88482612da0565b905085846001600160a01b03167f71bab65ced2e5750775a0613be067df48ef06cf92a496ebf7663ae06609249548360405161151691815260200190565b60405180910390a3505b838160000160008282546115349190614206565b9091555050600281015460ca546040516370a0823160e01b81526001600160a01b0386811660048301526115c99216906370a082319060240160206040518083038186803b15801561158557600080fd5b505afa158015611599573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115bd9190614257565b83546109a591906141e7565b60028301819055600584015482916115e091614206565b6115ea9190614240565b60058401556006830154600283015464e8d4a5100091611609916141e7565b6003850154845461161a91906141e7565b6116249190614206565b61162e919061421e565b8260010181905550600060d1878154811061164b5761164b6141bb565b60009182526020909120600460079092020101546001600160a01b0316905080156116f8578254604051637135edff60e11b81526001600160a01b03878116600483015260248201929092529082169063e26bdbfe90604401602060405180830381600087803b1580156116be57600080fd5b505af11580156116d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116f69190614257565b505b835461170f906001600160a01b0316333089613679565b86856001600160a01b03167f16f3fbfd4bcc50a5cecb2e53e398a1ad77d89f63288ef540d862b264ed57eb1f8860405161174b91815260200190565b60405180910390a3505060016065555050505050565b6033546001600160a01b031633146117a95760405162461bcd60e51b8152602060048201819052602482015260008051602061438983398151915260448201526064016105ee565b6001600160a01b0381166117bc57600080fd5b6117c4610f17565b60ca80546001600160a01b038381166001600160a01b0319831681179093556040805191909216808252602082019390935233917fcdc066eb512c135b027caebc803aa836c938e3e26bb2756b395da32ce0139e47910160405180910390a25050565b6033546001600160a01b0316331461186f5760405162461bcd60e51b8152602060048201819052602482015260008051602061438983398151915260448201526064016105ee565b813b6118e35760405162461bcd60e51b815260206004820152602660248201527f6164643a204c5020746f6b656e206d75737420626520612076616c696420636f60448201527f6e7472616374000000000000000000000000000000000000000000000000000060648201526084016105ee565b803b1515806118f957506001600160a01b038116155b6119545760405162461bcd60e51b815260206004820152602660248201527f6164643a207265776172646572206d75737420626520636f6e7472616374206f60448201526572207a65726f60d01b60648201526084016105ee565b61195f60d2836136ca565b156119ac5760405162461bcd60e51b815260206004820152601560248201527f6164643a204c5020616c7265616479206164646564000000000000000000000060448201526064016105ee565b6119b4610f17565b600060d05442116119c75760d0546119c9565b425b90508360cf546119d99190614206565b60cf556040805160e0810182526001600160a01b038086168252602082018781529282018481526000606084018181528784166080860190815260a0860183815260c0870184815260d180546001810182559552965160079094027f695fb3134ad82c3b8022bc5464edd0bcc9424ef672b52245dcb6ab2374327ce3810180549588166001600160a01b031996871617905597517f695fb3134ad82c3b8022bc5464edd0bcc9424ef672b52245dcb6ab2374327ce489015593517f695fb3134ad82c3b8022bc5464edd0bcc9424ef672b52245dcb6ab2374327ce588015590517f695fb3134ad82c3b8022bc5464edd0bcc9424ef672b52245dcb6ab2374327ce6870155517f695fb3134ad82c3b8022bc5464edd0bcc9424ef672b52245dcb6ab2374327ce78601805491909416911617909155517f695fb3134ad82c3b8022bc5464edd0bcc9424ef672b52245dcb6ab2374327ce8830155517f695fb3134ad82c3b8022bc5464edd0bcc9424ef672b52245dcb6ab2374327ce990910155611b6360d2846136ef565b50816001600160a01b0316836001600160a01b0316600160d180549050611b8a9190614240565b6040518781527f4b16bd2431ad24dc020ab0e1de7fcb6563dead6a24fb10089d6c23e97a70381f9060200160405180910390a450505050565b60006060600060d18481548110611bdc57611bdc6141bb565b6000918252602090912060079091020160048101549091506001600160a01b031615611d9857600480820154604080517ff7c618c100000000000000000000000000000000000000000000000000000000815290516001600160a01b039092169263f7c618c1928282019260209290829003018186803b158015611c5f57600080fd5b505afa158015611c73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c97919061428b565b92508060040160009054906101000a90046001600160a01b03166001600160a01b031663f7c618c16040518163ffffffff1660e01b815260040160206040518083038186803b158015611ce957600080fd5b505afa158015611cfd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d21919061428b565b6001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b158015611d5957600080fd5b505afa158015611d6d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611d9591908101906142a8565b91505b50915091565b600054610100900460ff1680611db7575060005460ff16155b611e1a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016105ee565b600054610100900460ff16158015611e3c576000805461ffff19166101011790555b6001600160a01b038616611e925760405162461bcd60e51b815260206004820152601a60248201527f70747020616464726573732063616e6e6f74206265207a65726f00000000000060448201526064016105ee565b6001600160a01b038516611ee85760405162461bcd60e51b815260206004820152601c60248201527f766550747020616464726573732063616e6e6f74206265207a65726f0000000060448201526064016105ee565b83611f355760405162461bcd60e51b815260206004820152601a60248201527f70747020706572207365632063616e6e6f74206265207a65726f00000000000060448201526064016105ee565b6103e8831115611fad5760405162461bcd60e51b815260206004820152602e60248201527f6469616c7574696e67207265706172746974696f6e206d75737420626520696e60448201527f2072616e676520302c203130303000000000000000000000000000000000000060648201526084016105ee565b611fb5613704565b611fbd6137c6565b611fc561387d565b60c980546001600160a01b038089166001600160a01b03199283161790925560ca80549288169290911691909117905560cc84905560cd83905561200b836103e8614240565b60ce5560d0829055600060cf55801561202a576000805461ff00191690555b505050505050565b600260655414156120855760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105ee565b600260655560cb546001600160a01b03166120e25760405162461bcd60e51b815260206004820152600960248201527f746f2077686572653f000000000000000000000000000000000000000000000060448201526064016105ee565b61211e82828080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061309f92505050565b50505060005b818110156122da576000838383818110612140576121406141bb565b60209081029290920135600081815260d484526040808220338352909452929092208054929350911590506122c757600060d18381548110612184576121846141bb565b60009182526020909120600790910201805460cb5484546040517f095ea7b30000000000000000000000000000000000000000000000000000000081526001600160a01b0392831660048201526024810191909152929350169063095ea7b390604401602060405180830381600087803b15801561220157600080fd5b505af1158015612215573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612239919061433c565b5060cb5482546040517f90210d7e0000000000000000000000000000000000000000000000000000000081526004810186905260248101919091523360448201526001600160a01b03909116906390210d7e90606401600060405180830381600087803b1580156122a957600080fd5b505af11580156122bd573d6000803e3d6000fd5b5050600084555050505b5050806122d390614270565b9050612124565b5050600160655550565b6033546001600160a01b0316331461232c5760405162461bcd60e51b8152602060048201819052602482015260008051602061438983398151915260448201526064016105ee565b6103e881111561233b57600080fd5b612343610f17565b60cd819055612354816103e8614240565b60ce55337fb24c3afbe477581b073ec4a6f19df34024e917cee6bb519129629defa718f63082612386816103e8614240565b60408051928352602083019190915201610632565b600080600260655414156123f15760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105ee565b600260655560975460ff161561243c5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016105ee565b600060d18581548110612451576124516141bb565b6000918252602080832088845260d48252604080852033865290925292206007909102909101915061248286612b9d565b80546000901561256f576001820154600088815260d5602090815260408083203384529091529020546006850154600285015464e8d4a51000916124c5916141e7565b600387015486546124d691906141e7565b6124e09190614206565b6124ea919061421e565b6124f49190614206565b6124fe9190614240565b600088815260d5602090815260408083203380855292528220919091559091506125289082612da0565b905086336001600160a01b03167f71bab65ced2e5750775a0613be067df48ef06cf92a496ebf7663ae06609249548360405161256691815260200190565b60405180910390a35b858260000160008282546125839190614206565b9091555050600282015460ca546040516370a0823160e01b81523360048201526125bf916001600160a01b0316906370a0823190602401610949565b60028401819055600585015482916125d691614206565b6125e09190614240565b60058501556006840154600284015464e8d4a51000916125ff916141e7565b6003860154855461261091906141e7565b61261a9190614206565b612624919061421e565b8360010181905550600060d18981548110612641576126416141bb565b600091825260208220600460079092020101546001600160a01b0316915081156126eb578454604051637135edff60e11b815233600482015260248101919091526001600160a01b0383169063e26bdbfe90604401602060405180830381600087803b1580156126b057600080fd5b505af11580156126c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126e89190614257565b90505b8554612702906001600160a01b031633308c613679565b6040518981528a9033907f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a1590602001610b1c565b6033546001600160a01b0316331461277e5760405162461bcd60e51b8152602060048201819052602482015260008051602061438983398151915260448201526064016105ee565b6001600160a01b0381166127fa5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016105ee565b610df2816135ac565b600080606060008060d1878154811061281e5761281e6141bb565b600091825260208083208a845260d4825260408085206001600160a01b038c81168752935280852060079490940290910160038101546006820154825493516370a0823160e01b81523060048201529297509495909493909216906370a082319060240160206040518083038186803b15801561289a57600080fd5b505afa1580156128ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128d29190614257565b90508460020154421180156128e657508015155b156129be5760008560020154426128fd9190614240565b9050600060cf54876001015460cc548461291791906141e7565b61292191906141e7565b61292b919061421e565b9050612939836103e86141e7565b60cd5461294b8364e8d4a510006141e7565b61295591906141e7565b61295f919061421e565b6129699086614206565b945086600501546000146129bb576005870154612988906103e86141e7565b60ce5461299a8364e8d4a510006141e7565b6129a491906141e7565b6129ae919061421e565b6129b89085614206565b93505b50505b600184015460008c815260d5602090815260408083206001600160a01b038f168452909152902054600286015464e8d4a51000906129fd9086906141e7565b8754612a0a9088906141e7565b612a149190614206565b612a1e919061421e565b612a289190614206565b612a329190614240565b60048601549099506001600160a01b031615612af357612a518b611bc3565b6004878101546040517fc031a66f0000000000000000000000000000000000000000000000000000000081526001600160a01b038f811693820193909352939b50919950169063c031a66f9060240160206040518083038186803b158015612ab857600080fd5b505afa158015612acc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612af09190614257565b95505b505050505092959194509250565b60975460ff16612b535760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f742070617573656400000000000000000000000060448201526064016105ee565b6097805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600060d18281548110612bb257612bb26141bb565b906000526020600020906007020190508060020154421115610f3e5780546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b158015612c1157600080fd5b505afa158015612c25573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c499190614257565b905080612c5b57504260029091015550565b6000826002015442612c6d9190614240565b9050600060cf54846001015460cc5484612c8791906141e7565b612c9191906141e7565b612c9b919061421e565b9050612ca9836103e86141e7565b60cd54612cbb8364e8d4a510006141e7565b612cc591906141e7565b612ccf919061421e565b846003016000828254612ce29190614206565b90915550506005840154612cfc5760006006850155612d4c565b6005840154612d0d906103e86141e7565b60ce54612d1f8364e8d4a510006141e7565b612d2991906141e7565b612d33919061421e565b846006016000828254612d469190614206565b90915550505b42600285018190556003850154604080519283526020830186905282015285907f3be3541fc42237d611b30329040bfa4569541d156560acdbbae57640d20b8f469060600160405180910390a25050505050565b60c9546040516370a0823160e01b815230600482015260009182916001600160a01b03909116906370a082319060240160206040518083038186803b158015612de857600080fd5b505afa158015612dfc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e209190614257565b905060008111612e725760405162461bcd60e51b815260206004820152601760248201527f4e6f20746f6b656e7320746f206469737472696275746500000000000000000060448201526064016105ee565b80831115612f085760c95460405163a9059cbb60e01b81526001600160a01b038681166004830152602482018490529091169063a9059cbb90604401602060405180830381600087803b158015612ec857600080fd5b505af1158015612edc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f00919061433c565b509050612f94565b60c95460405163a9059cbb60e01b81526001600160a01b038681166004830152602482018690529091169063a9059cbb90604401602060405180830381600087803b158015612f5657600080fd5b505af1158015612f6a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f8e919061433c565b50829150505b92915050565b60006003821115612ffb5750806000612fb460028361421e565b612fbf906001614206565b90505b81811015612ff557905080600281612fda818661421e565b612fe49190614206565b612fee919061421e565b9050612fc2565b50919050565b8115613005575060015b919050565b6040516001600160a01b03831660248201526044810182905261309a90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152613939565b505050565b6000606080600080855167ffffffffffffffff8111156130c1576130c1613d8f565b6040519080825280602002602001820160405280156130ea578160200160208202803683370190505b5090506000865167ffffffffffffffff81111561310957613109613d8f565b604051908082528060200260200182016040528015613132578160200160208202803683370190505b50905060005b875181101561341057613163888281518110613156576131566141bb565b6020026020010151612b9d565b600060d1898381518110613179576131796141bb565b602002602001015181548110613191576131916141bb565b90600052602060002090600702019050600060d460008b85815181106131b9576131b96141bb565b6020908102919091018101518252818101929092526040908101600090812033825290925290208054909150156133fd576000816001015460d560008d8781518110613207576132076141bb565b602002602001015181526020019081526020016000206000336001600160a01b03166001600160a01b031681526020019081526020016000205464e8d4a510008560060154856002015461325b91906141e7565b6003870154865461326c91906141e7565b6132769190614206565b613280919061421e565b61328a9190614206565b6132949190614240565b9050600060d560008d87815181106132ae576132ae6141bb565b602090810291909101810151825281810192909252604090810160009081203382529092529020556006830154600283015464e8d4a51000916132f0916141e7565b6003850154845461330191906141e7565b61330b9190614206565b613315919061421e565b60018301556133248188614206565b965080868581518110613339576133396141bb565b602090810291909101015260048301546001600160a01b031680156133fa578254604051637135edff60e11b815233600482015260248101919091526001600160a01b0382169063e26bdbfe90604401602060405180830381600087803b1580156133a357600080fd5b505af11580156133b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133db9190614257565b8686815181106133ed576133ed6141bb565b6020026020010181815250505b50505b50508061340990614270565b9050613138565b50600061341d3385612da0565b905083811461350c5760005b88518110156135065784848281518110613445576134456141bb565b60200260200101518361345891906141e7565b613462919061421e565b848281518110613474576134746141bb565b602002602001018181525050888181518110613492576134926141bb565b6020026020010151336001600160a01b03167f71bab65ced2e5750775a0613be067df48ef06cf92a496ebf7663ae06609249548684815181106134d7576134d76141bb565b60200260200101516040516134ee91815260200190565b60405180910390a36134ff81614270565b9050613429565b506135a0565b60005b885181101561359e5788818151811061352a5761352a6141bb565b6020026020010151336001600160a01b03167f71bab65ced2e5750775a0613be067df48ef06cf92a496ebf7663ae066092495486848151811061356f5761356f6141bb565b602002602001015160405161358691815260200190565b60405180910390a361359781614270565b905061350f565b505b97919650945092505050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60975460ff16156136445760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016105ee565b6097805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258612b803390565b6040516001600160a01b0380851660248301528316604482015260648101829052610de39085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401613036565b6001600160a01b038116600090815260018301602052604081205415155b9392505050565b60006136e8836001600160a01b038416613a1e565b600054610100900460ff168061371d575060005460ff16155b6137805760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016105ee565b600054610100900460ff161580156137a2576000805461ffff19166101011790555b6137aa613a6d565b6137b2613b1e565b8015610df2576000805461ff001916905550565b600054610100900460ff16806137df575060005460ff16155b6138425760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016105ee565b600054610100900460ff16158015613864576000805461ffff19166101011790555b60016065558015610df2576000805461ff001916905550565b600054610100900460ff1680613896575060005460ff16155b6138f95760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016105ee565b600054610100900460ff1615801561391b576000805461ffff19166101011790555b6097805460ff191690558015610df2576000805461ff001916905550565b600061398e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613bc59092919063ffffffff16565b80519091501561309a57808060200190518101906139ac919061433c565b61309a5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016105ee565b6000818152600183016020526040812054613a6557508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155612f94565b506000612f94565b600054610100900460ff1680613a86575060005460ff16155b613ae95760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016105ee565b600054610100900460ff161580156137b2576000805461ffff19166101011790558015610df2576000805461ff001916905550565b600054610100900460ff1680613b37575060005460ff16155b613b9a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016105ee565b600054610100900460ff16158015613bbc576000805461ffff19166101011790555b6137b2336135ac565b6060613bd48484600085613bdc565b949350505050565b606082471015613c545760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016105ee565b843b613ca25760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016105ee565b600080866001600160a01b03168587604051613cbe9190614359565b60006040518083038185875af1925050503d8060008114613cfb576040519150601f19603f3d011682016040523d82523d6000602084013e613d00565b606091505b5091509150613d10828286613d1b565b979650505050505050565b60608315613d2a5750816136e8565b825115613d3a5782518084602001fd5b8160405162461bcd60e51b81526004016105ee9190614375565b600060208284031215613d6657600080fd5b5035919050565b60008060408385031215613d8057600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613dce57613dce613d8f565b604052919050565b60006020808385031215613de957600080fd5b823567ffffffffffffffff80821115613e0157600080fd5b818501915085601f830112613e1557600080fd5b813581811115613e2757613e27613d8f565b8060051b9150613e38848301613da5565b8181529183018401918481019088841115613e5257600080fd5b938501935b83851015613e7057843582529385019390850190613e57565b98975050505050505050565b600081518084526020808501945080840160005b83811015613eac57815187529582019590820190600101613e90565b509495945050505050565b838152606060208201526000613ed06060830185613e7c565b8281036040840152613ee28185613e7c565b9695505050505050565b6001600160a01b0381168114610df257600080fd5b60008060408385031215613f1457600080fd5b8235613f1f81613eec565b946020939093013593505050565b600060208284031215613f3f57600080fd5b81356136e881613eec565b8015158114610df257600080fd5b60008060008060808587031215613f6e57600080fd5b84359350602085013592506040850135613f8781613eec565b91506060850135613f9781613f4a565b939692955090935050565b60008060408385031215613fb557600080fd5b823591506020830135613fc781613eec565b809150509250929050565b600080600060608486031215613fe757600080fd5b8335925060208401359150604084013561400081613eec565b809150509250925092565b60008060006060848603121561402057600080fd5b83359250602084013561403281613eec565b9150604084013561400081613eec565b60005b8381101561405d578181015183820152602001614045565b83811115610de35750506000910152565b60008151808452614086816020860160208601614042565b601f01601f19169290920160200192915050565b6001600160a01b0383168152604060208201526000613bd4604083018461406e565b600080600080600060a086880312156140d457600080fd5b85356140df81613eec565b945060208601356140ef81613eec565b94979496505050506040830135926060810135926080909101359150565b6000806020838503121561412057600080fd5b823567ffffffffffffffff8082111561413857600080fd5b818501915085601f83011261414c57600080fd5b81358181111561415b57600080fd5b8660208260051b850101111561417057600080fd5b60209290920196919550909350505050565b8481526001600160a01b03841660208201526080604082015260006141aa608083018561406e565b905082606083015295945050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615614201576142016141d1565b500290565b60008219821115614219576142196141d1565b500190565b60008261423b57634e487b7160e01b600052601260045260246000fd5b500490565b600082821015614252576142526141d1565b500390565b60006020828403121561426957600080fd5b5051919050565b6000600019821415614284576142846141d1565b5060010190565b60006020828403121561429d57600080fd5b81516136e881613eec565b6000602082840312156142ba57600080fd5b815167ffffffffffffffff808211156142d257600080fd5b818401915084601f8301126142e657600080fd5b8151818111156142f8576142f8613d8f565b61430b601f8201601f1916602001613da5565b915080825285602082850101111561432257600080fd5b614333816020840160208601614042565b50949350505050565b60006020828403121561434e57600080fd5b81516136e881613f4a565b6000825161436b818460208701614042565b9190910192915050565b6020815260006136e8602083018461406e56fe4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a26469706673582212202c520007f80e8c70cc5baf558f99d65d461743cfa05d2df21e7d1e8f6ff2448664736f6c63430008090033

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

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]

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