ETH Price: $3,297.03 (+0.01%)

Contract

0x25245941137d9C85B5D48aE8d7788aA841BEB9aE
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Withdraw186139802023-11-20 15:46:23426 days ago1700495183IN
0x25245941...841BEB9aE
0 ETH0.0036056331.87382816
Withdraw182020632023-09-24 0:22:35484 days ago1695514955IN
0x25245941...841BEB9aE
0 ETH0.001106479.54496825
Multi Claim181379582023-09-15 0:05:59493 days ago1694736359IN
0x25245941...841BEB9aE
0 ETH0.0006846410.67507889
Withdraw181379582023-09-15 0:05:59493 days ago1694736359IN
0x25245941...841BEB9aE
0 ETH0.0012374710.67507889
Multi Claim181066832023-09-10 14:50:59497 days ago1694357459IN
0x25245941...841BEB9aE
0 ETH0.0009025110.94993288
Withdraw180407162023-09-01 9:09:59506 days ago1693559399IN
0x25245941...841BEB9aE
0 ETH0.0012272612
Multi Claim180407162023-09-01 9:09:59506 days ago1693559399IN
0x25245941...841BEB9aE
0 ETH0.0009820111.91793119
Withdraw180088022023-08-27 21:53:23511 days ago1693173203IN
0x25245941...841BEB9aE
0 ETH0.001517811.6259797
Withdraw180061712023-08-27 13:02:11511 days ago1693141331IN
0x25245941...841BEB9aE
0 ETH0.0027739820.85733229
Withdraw179621672023-08-21 9:19:11517 days ago1692609551IN
0x25245941...841BEB9aE
0 ETH0.0018208113.76513985
Multi Claim179621632023-08-21 9:18:23517 days ago1692609503IN
0x25245941...841BEB9aE
0 ETH0.0010648412.92320616
Multi Claim179555022023-08-20 10:56:59518 days ago1692529019IN
0x25245941...841BEB9aE
0 ETH0.0009657411.72045579
Withdraw179234822023-08-15 23:20:59523 days ago1692141659IN
0x25245941...841BEB9aE
0 ETH0.0028904319.67663073
Multi Claim179061852023-08-13 13:18:23525 days ago1691932703IN
0x25245941...841BEB9aE
0 ETH0.0019875419.97571539
Multi Claim178757432023-08-09 7:05:23529 days ago1691564723IN
0x25245941...841BEB9aE
0 ETH0.0015256618.51585967
Withdraw178536062023-08-06 4:42:47533 days ago1691296967IN
0x25245941...841BEB9aE
0 ETH0.0024697918.18728468
Multi Claim178324172023-08-03 5:34:35535 days ago1691040875IN
0x25245941...841BEB9aE
0 ETH0.0011548414.01540191
Multi Claim178323892023-08-03 5:28:59535 days ago1691040539IN
0x25245941...841BEB9aE
0 ETH0.0010242512.43056745
Deposit178182882023-08-01 6:14:11537 days ago1690870451IN
0x25245941...841BEB9aE
0 ETH0.002449319.10042449
Multi Claim178182682023-08-01 6:10:11537 days ago1690870211IN
0x25245941...841BEB9aE
0 ETH0.0012292514.91855852
Deposit178161772023-07-31 23:08:23538 days ago1690844903IN
0x25245941...841BEB9aE
0 ETH0.0030723924.00589092
Multi Claim178161472023-07-31 23:02:23538 days ago1690844543IN
0x25245941...841BEB9aE
0 ETH0.0021441226.02162478
Deposit178119942023-07-31 9:08:11538 days ago1690794491IN
0x25245941...841BEB9aE
0 ETH0.0020351415.35530785
Multi Claim178119882023-07-31 9:06:59538 days ago1690794419IN
0x25245941...841BEB9aE
0 ETH0.0012892915.64715832
Deposit178061222023-07-30 13:23:59539 days ago1690723439IN
0x25245941...841BEB9aE
0 ETH0.0021737916.698
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
MasterBids

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 15 : MasterBids.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.5;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "../library/DSMath.sol";
import "../interfaces/IVeBids.sol";
import "../interfaces/IMasterBids.sol";
import "../interfaces/IRewarder.sol";

interface IVoter {
    function distribute(address _lpToken) external;
}

/// @title MasterBids
/// @notice MasterBids is a boss. He is not afraid of any snakes. In fact, he drinks their venoms. So, veBids holders boost
/// their (boosted) emissions. This contract rewards users in function of their amount of lp staked (base pool) factor (boosted pool)
/// Factor and sumOfFactors are updated by contract VeBids.sol after any veBids minting/burning (veERC20Upgradeable hook).
/// Note that it's ownable and the owner wields tremendous power. The ownership
/// will be safeTransferred to a governance smart contract once Bids is sufficiently
/// distributed and the community can show to govern itself.
/// @dev Updates:
/// - Compatible with gauge voting
contract MasterBids is Ownable, ReentrancyGuard, Pausable, IMasterBids {
    using EnumerableSet for EnumerableSet.AddressSet;
    using SafeERC20 for IERC20;

    // Info of each user.
    struct UserInfo {
        // storage slot 1
        uint128 amount; // 20.18 fixed point. How many LP tokens the user has provided.
        uint128 factor; // 20.18 fixed point. boosted factor = sqrt (lpAmount * veBids.balanceOf())
        // storage slot 2
        uint128 rewardDebt; // 20.18 fixed point. Reward debt. See explanation below.
        uint128 pendingBids; // 20.18 fixed point. Amount of pending Bids
        //
        // We do some fancy math here. Basically, any point in time, the amount of Bids
        // entitled to a user but is pending to be distributed is:
        //
        //   ((user.amount * pool.accBidsPerShare + user.factor * pool.accBidsPerFactorShare) / 1e12) -
        //        user.rewardDebt
        //
        // Whenever a user deposits or withdraws LP tokens to a pool. Here's what happens:
        //   1. The pool's `accBidsPerShare`, `accBidsPerFactorShare` (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 PoolInfoV3 {
        IERC20 lpToken; // Address of LP token contract.
        IRewarder rewarder;
        uint40 periodFinish;
        ////
        uint128 sumOfFactors; // 20.18 fixed point. the sum of all boosted factors by all of the users in the pool
        uint128 rewardRate; // 20.18 fixed point.
        ////
        uint104 accBidsPerShare; // 19.12 fixed point. Accumulated Bids per share, times 1e12.
        uint104 accBidsPerFactorShare; // 19.12 fixed point. Accumulated Bids per factor share
        uint40 lastRewardTimestamp;
    }

    uint256 public constant ACC_TOKEN_PRECISION = 1e12;

    // Bids token
    IERC20 public Bids;
    // Venom does not seem to hurt the Bids, it only makes it stronger.
    IVeBids public veBids;
    // New Master Bids address for future migrations
    IMasterBids public newMasterBids;
    // Address of Voter
    address public voter;
    //Dictates if voter has distribute function
    bool public voterIsCallable;
    // Base partition emissions (e.g. 300 for 30%).
    // BasePartition and boostedPartition add up to 1000 for 100%
    uint16 public basePartition;
    // Set of all LP tokens that have been added as pools
    EnumerableSet.AddressSet private lpTokens;
    // Info of each pool.
    PoolInfoV3[] public poolInfoV3;
    // userInfo[pid][user], Info of each user that stakes LP tokens
    mapping(uint256 => mapping(address => UserInfo)) public userInfo;
    // Mapping of asset to pid. Offset by +1 to distinguish with default value
    mapping(address => uint256) internal assetPid;

    event Add(uint256 indexed pid, IERC20 indexed lpToken);
    event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
    event DepositFor(address indexed user, uint256 indexed pid, uint256 amount);
    event SetRewarder(uint256 indexed pid, IRewarder rewarder);
    event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
    event Harvest(address indexed user, uint256 indexed pid, uint256 amount);
    event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
    event UpdateEmissionPartition(address indexed user, uint256 basePartition, uint256 boostedPartition);
    event UpdateVeBids(address indexed user, address oldVeBids, address newVeBids);
    event UpdateVoter(address indexed user, address oldVoter, address newVoter, bool callable);
    event EmergencyBidsWithdraw(address owner, uint256 balance);
    event NewMaster(address _newMaster);

    /// @dev Modifier ensuring that certain function can only be called by VeBids
    modifier onlyVeBids() {
        require(address(veBids) == msg.sender, "MasterBids: caller is not VeBids");
        _;
    }

    /// @dev Modifier ensuring that certain function can only be called by Voter
    modifier onlyVoter() {
        require(address(voter) == msg.sender, "MasterBids: caller is not Voter");
        _;
    }

    constructor(IERC20 _Bids, IVeBids _veBids, address _voter, uint16 _basePartition) {
        require(address(_Bids) != address(0), "Bids address cannot be zero");
        require(address(_veBids) != address(0), "VeBids address cannot be zero");
        require(_voter != address(0), "Voter address cannot be zero");
        require(_basePartition <= 1000, "base partition must be in range 0, 1000");

        Bids = _Bids;
        veBids = _veBids;
        voter = _voter;
        basePartition = _basePartition;
    }

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

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

    function setNewMasterBids(IMasterBids _newMasterBids) external onlyOwner {
        newMasterBids = _newMasterBids;
        emit NewMaster(address(_newMasterBids));
    }

    /// @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 _lpToken the corresponding lp token
    /// @param _rewarder the contract that implements "onReward(user)" that is called on user operation
    function add(IERC20 _lpToken, IRewarder _rewarder) external onlyOwner {
        require(Address.isContract(address(_lpToken)), "add: LP token must be a valid contract");
        require(!lpTokens.contains(address(_lpToken)), "add: LP already added");

        // update PoolInfoV3 with the new LP
        poolInfoV3.push(
            PoolInfoV3({
                lpToken: _lpToken,
                rewarder: _rewarder,
                lastRewardTimestamp: uint40(block.timestamp),
                accBidsPerShare: 0,
                accBidsPerFactorShare: 0,
                sumOfFactors: 0,
                periodFinish: uint40(block.timestamp),
                rewardRate: 0
            })
        );
        assetPid[address(_lpToken)] = poolInfoV3.length;

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

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

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

    function _updatePool(uint256 _pid) private {
        PoolInfoV3 storage pool = poolInfoV3[_pid];

        if (block.timestamp > pool.lastRewardTimestamp) {
            (uint256 accBidsPerShare, uint256 accBidsPerFactorShare) = calRewardPerUnit(_pid);
            pool.accBidsPerShare = to104(accBidsPerShare);
            pool.accBidsPerFactorShare = to104(accBidsPerFactorShare);
            pool.lastRewardTimestamp = uint40(lastTimeRewardApplicable(pool.periodFinish));
        }

        // We can consider to skip this function to minimize gas
        if (voterIsCallable) {
            IVoter(voter).distribute(address(pool.lpToken));
        }
    }

    /// @dev Refer to synthetix/StakingRewards.sol notifyRewardAmount
    /// Note: This looks safe from reentrancy.
    function notifyRewardAmount(address _lpToken, uint256 _amount, uint256 _rewardDuration) external override onlyVoter {
        require(_amount > 0, "notifyRewardAmount: zero amount");

        // this line reverts if asset is not in the list
        uint256 pid = assetPid[_lpToken] - 1;
        PoolInfoV3 storage pool = poolInfoV3[pid];
        if (pool.lastRewardTimestamp >= pool.periodFinish) {
            pool.rewardRate = to128(_amount / _rewardDuration);
        } else {
            uint256 remainingTime = pool.periodFinish - pool.lastRewardTimestamp;
            uint256 leftoverReward = remainingTime * pool.rewardRate;
            pool.rewardRate = to128((_amount + leftoverReward) / _rewardDuration);
        }

        pool.lastRewardTimestamp = uint40(block.timestamp);
        pool.periodFinish = uint40(block.timestamp + _rewardDuration);

        // Event is not emitted as Voter should have already emitted it
    }

    /// @notice Helper function to migrate fund from multiple pools to the new MasterBids.
    /// @notice user must initiate transaction from masterbids
    /// @dev Assume the original MasterBids has stopped emissions
    /// hence we skip IVoter(voter).distribute() to save gas cost
    function migrate(uint256[] calldata _pids) external override nonReentrant {
        require(address(newMasterBids) != (address(0)), "to where?");

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

            if (user.amount > 0) {
                PoolInfoV3 storage pool = poolInfoV3[pid];
                pool.lpToken.approve(address(newMasterBids), user.amount);
                uint256 newPid = newMasterBids.getAssetPid(address(pool.lpToken));
                newMasterBids.depositFor(newPid, user.amount, msg.sender);

                pool.sumOfFactors -= user.factor;
                // remove user
                delete userInfo[pid][msg.sender];
            }
        }
    }

    /// @notice Deposit LP tokens to masterbids for Bids allocation on behalf of user
    /// @dev user must initiate transaction from masterbids
    /// @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 whenNotPaused {
        PoolInfoV3 storage pool = poolInfoV3[_pid];
        UserInfo storage user = userInfo[_pid][_user];

        // update pool in case user has deposited
        _updatePool(_pid);

        _updateUserAmount(_pid, _user, user.amount + _amount);

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

    /// @notice Deposit LP tokens to masterbids for Bids 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 reward, uint256[] memory additionalRewards) {
        PoolInfoV3 storage pool = poolInfoV3[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];

        // update pool in case user has deposited
        _updatePool(_pid);

        (reward, additionalRewards) = _updateUserAmount(_pid, msg.sender, user.amount + _amount);


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

    /// @notice claims rewards for multiple pids
    /// @param _pids array pids, pools to claim
    function multiClaim(
        uint256[] calldata _pids
    )
        external
        override
        nonReentrant
        whenNotPaused
        returns (uint256 reward, uint256[] memory amounts, uint256[][] memory additionalRewards)
    {
        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 reward, uint256[] memory amounts, uint256[][] memory additionalRewards) {
        // accumulate rewards for each one of the pids in pending
        amounts = new uint256[](_pids.length);
        additionalRewards = new uint256[][](_pids.length);
        for (uint256 i; i < _pids.length; ++i) {
            UserInfo storage user = userInfo[_pids[i]][msg.sender];
            _updatePool(_pids[i]);

            if (user.amount > 0) {
                PoolInfoV3 storage pool = poolInfoV3[_pids[i]];
                // increase pending to send all rewards once
                uint256 poolRewards = ((uint256(user.amount) *
                    pool.accBidsPerShare +
                    uint256(user.factor) *
                    pool.accBidsPerFactorShare) / ACC_TOKEN_PRECISION) +
                    user.pendingBids -
                    user.rewardDebt;

                user.pendingBids = 0;

                // update reward debt
                user.rewardDebt = to128(
                    (uint256(user.amount) * pool.accBidsPerShare + uint256(user.factor) * pool.accBidsPerFactorShare) /
                        ACC_TOKEN_PRECISION
                );

                // increase reward
                reward += poolRewards;

                amounts[i] = poolRewards;
                emit Harvest(msg.sender, _pids[i], amounts[i]);

                // if exist, update external rewarder
                IRewarder rewarder = pool.rewarder;
                if (address(rewarder) != address(0)) {
                    additionalRewards[i] = rewarder.onReward(msg.sender);
                }
            }
        }

        // safeTransfer all rewards
        Bids.safeTransfer(payable(msg.sender), reward);
    }

    /// @notice Withdraw LP tokens from MasterBids.
    /// @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 reward, uint256[] memory additionalRewards) {
        PoolInfoV3 storage pool = poolInfoV3[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];
        require(user.amount >= _amount, "withdraw: not enough balance");

        _updatePool(_pid);

        (reward, additionalRewards) = _updateUserAmount(_pid, msg.sender, user.amount - _amount);

        pool.lpToken.safeTransfer(msg.sender, _amount);
        emit Withdraw(msg.sender, _pid, _amount);
    }

    /// @notice Update user balance and distribute Bids rewards
    function _updateUserAmount(
        uint256 _pid,
        address _user,
        uint256 _amount
    ) internal returns (uint256 reward, uint256[] memory additionalRewards) {
        PoolInfoV3 storage pool = poolInfoV3[_pid];
        UserInfo storage user = userInfo[_pid][_user];

        // Harvest Bids
        if (user.amount > 0 || user.pendingBids > 0) {
            reward =
                ((uint256(user.amount) * pool.accBidsPerShare + uint256(user.factor) * pool.accBidsPerFactorShare) /
                    ACC_TOKEN_PRECISION) +
                user.pendingBids -
                user.rewardDebt;
            user.pendingBids = 0;

            Bids.safeTransfer(payable(_user), reward);
            emit Harvest(_user, _pid, reward);
        }

        // update amount of lp staked
        user.amount = to128(_amount);

        // update sumOfFactors
        uint128 oldFactor = user.factor;
        user.factor = to128(DSMath.sqrt(user.amount * veBids.balanceOf(_user), user.amount));

        // update reward debt
        user.rewardDebt = to128(
            (uint256(user.amount) * pool.accBidsPerShare + uint256(user.factor) * pool.accBidsPerFactorShare) / ACC_TOKEN_PRECISION
        );

        // claim reward before we update factors (Due to rewarder ratios being based on masters rewards)
        IRewarder rewarder = pool.rewarder;
        if (address(rewarder) != address(0)) {
            additionalRewards = rewarder.onReward(_user);
        }

        pool.sumOfFactors = to128(pool.sumOfFactors + user.factor - oldFactor);
    }

    /// @notice Withdraw without caring about rewards. EMERGENCY ONLY.
    /// @param _pid the pool id
    function emergencyWithdraw(uint256 _pid) external override nonReentrant {
        PoolInfoV3 storage pool = poolInfoV3[_pid];

        UserInfo storage user = userInfo[_pid][msg.sender];

        pool.lpToken.safeTransfer(address(msg.sender), user.amount);

        pool.sumOfFactors = pool.sumOfFactors - user.factor;

        user.amount = 0;
        user.factor = 0;
        user.rewardDebt = 0;

        IRewarder rewarder = pool.rewarder;
        if (address(rewarder) != address(0)) {
            rewarder.onReward(msg.sender);
        }

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

    /// @notice updates emission partition
    /// @param _basePartition the future base partition
    function updateEmissionPartition(uint16 _basePartition) external onlyOwner {
        require(_basePartition <= 1000);
        massUpdatePools();
        basePartition = _basePartition;
        emit UpdateEmissionPartition(msg.sender, _basePartition, 1000 - _basePartition);
    }

    /// @notice updates veBids address
    /// @param _newVeBids the new VeBids address
    function setVeBids(IVeBids _newVeBids) external onlyOwner {
        require(address(_newVeBids) != address(0));
        IVeBids oldVeBids = veBids;
        veBids = _newVeBids;
        emit UpdateVeBids(msg.sender, address(oldVeBids), address(_newVeBids));
    }

    /// @notice updates voter address
    /// @param _newVoter the new Voter address
    function setVoter(address _newVoter, bool _voterIsCallable) external onlyOwner {
        // voter address can be zero during a migration. This is done to avoid
        // the scenario where both old and new MasterBids claims in migrate,
        // which calls voter.distribute. But only one can succeed as voter.distribute
        // is only callable from gauge manager.
        require(_newVoter != address(0), "Voter address cannot be zero");
        address oldVoter = voter;
        voter = _newVoter;
        voterIsCallable = _voterIsCallable;
        emit UpdateVoter(msg.sender, oldVoter, _newVoter, _voterIsCallable);
    }

    /// @notice updates factor after any veBids token operation (minting/burning)
    /// @param _user the user to update
    /// @param _newVeBidsBalance the amount of veBids
    /// @dev can only be called by veBids
    function updateFactor(address _user, uint256 _newVeBidsBalance) external override onlyVeBids {
        // loop over each pool : beware gas cost!
        uint256 length = poolInfoV3.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;
            }

            // first, update pool
            _updatePool(pid);
            PoolInfoV3 storage pool = poolInfoV3[pid];

            // calculate pending
            uint256 pending = ((uint256(user.amount) * pool.accBidsPerShare + uint256(user.factor) * pool.accBidsPerFactorShare) /
                ACC_TOKEN_PRECISION) - user.rewardDebt;
            // increase pendingBids
            user.pendingBids += to128(pending);

            // update boosted partition factor
            uint256 oldFactor = user.factor;
            uint256 newFactor = DSMath.sqrt(user.amount * _newVeBidsBalance, user.amount);
            user.factor = to128(newFactor);
            // update reward debt, take into account newFactor
            user.rewardDebt = to128(
                (uint256(user.amount) * pool.accBidsPerShare + newFactor * pool.accBidsPerFactorShare) / ACC_TOKEN_PRECISION
            );
            // also, update sumOfFactors
            pool.sumOfFactors = to128(pool.sumOfFactors + newFactor - oldFactor);
        }
    }

    /// @notice In case we need to manually migrate Bids funds from masterbids
    /// Sends all remaining Bids from the contract to the owner
    function emergencyBidsWithdraw() external onlyOwner {

        Bids.safeTransfer(address(msg.sender), Bids.balanceOf(address(this)));
        emit EmergencyBidsWithdraw(address(msg.sender), Bids.balanceOf(address(this)));
    }

    function boostedPartition() external view returns (uint256) {
        return 1000 - basePartition;
    }

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

    function getAssetPid(address asset) external view override returns (uint256) {
        // revert if asset not exist
        return assetPid[asset] - 1;
    }

    function lastTimeRewardApplicable(uint256 _periodFinish) public view returns (uint256) {
        return block.timestamp < _periodFinish ? block.timestamp : _periodFinish;
    }

    function calRewardPerUnit(uint256 _pid) public view returns (uint256 accBidsPerShare, uint256 accBidsPerFactorShare) {
        PoolInfoV3 storage pool = poolInfoV3[_pid];
        uint256 lpSupply = pool.lpToken.balanceOf(address(this));

        accBidsPerShare = pool.accBidsPerShare;
        accBidsPerFactorShare = pool.accBidsPerFactorShare;

        if (lpSupply == 0 || block.timestamp <= pool.lastRewardTimestamp) {
            // update only if now > lastRewardTimestamp
            return (accBidsPerShare, accBidsPerFactorShare);
        }

        uint256 secondsElapsed = lastTimeRewardApplicable(pool.periodFinish) - pool.lastRewardTimestamp;
        uint256 BidsReward = secondsElapsed * pool.rewardRate;
        accBidsPerShare += (BidsReward * ACC_TOKEN_PRECISION * basePartition) / (lpSupply * 1000);

        if (pool.sumOfFactors != 0) {
            accBidsPerFactorShare += (BidsReward * ACC_TOKEN_PRECISION * (1000 - basePartition)) / (pool.sumOfFactors * 1000);
        }
    }

    /// @notice View function to see pending Bids on frontend.
    /// @param _pid the pool id
    /// @param _user the user address
    function pendingTokens(
        uint256 _pid,
        address _user
    ) external view override returns (uint256 pendingRewards, uint256[] memory pendingRewarderRewards) {
        PoolInfoV3 memory pool = poolInfoV3[_pid];

        // calculate accBidsPerShare and accBidsPerFactorShare
        (uint256 accBidsPerShare, uint256 accBidsPerFactorShare) = calRewardPerUnit(_pid);

        UserInfo memory user = userInfo[_pid][_user];
        pendingRewards =
            ((user.amount * accBidsPerShare + user.factor * accBidsPerFactorShare) / ACC_TOKEN_PRECISION) +
            user.pendingBids -
            user.rewardDebt;

        // Rewarder tokens
        if (address(pool.rewarder) != address(0)) {
            pendingRewarderRewards = pool.rewarder.pendingTokens(_user);
        }
    }

    //For accurate pending Bids use pendingTokens instead.
    /// @notice View function to see pending Bids with factor and base separated.
    /// @param _pid the pool id
    /// @param _user the user address
    function pendingTokensSplit(
        uint256 _pid,
        address _user
    ) external view returns (uint256 pendingBaseRewards, uint256 pendingFactorRewards, uint256[] memory pendingRewarderRewards) {
        PoolInfoV3 memory pool = poolInfoV3[_pid];

        // calculate accBidsPerShare and accBidsPerFactorShare
        (uint256 accBidsPerShare, uint256 accBidsPerFactorShare) = calRewardPerUnit(_pid);

        UserInfo memory user = userInfo[_pid][_user];
        // Rewarder tokens
        if (address(pool.rewarder) != address(0)) {
            pendingRewarderRewards = pool.rewarder.pendingTokens(_user);
        }
        if (user.amount == 0) {
            return (0, 0, pendingRewarderRewards);
        }

        ////Working
        uint256 pendingBaseRewardsHigh = user.amount * accBidsPerShare;
        uint256 pendingFactorRewardsHigh = user.factor * accBidsPerFactorShare;
        uint256 pendingRewards = ((pendingBaseRewardsHigh + pendingFactorRewardsHigh) / ACC_TOKEN_PRECISION) +
            user.pendingBids -
            user.rewardDebt;

        pendingFactorRewards = (pendingRewards * pendingFactorRewardsHigh / (pendingBaseRewardsHigh + pendingFactorRewardsHigh));
        pendingBaseRewards = pendingRewards - pendingFactorRewards;
    }

    function to128(uint256 val) internal pure returns (uint128) {
        if (val > type(uint128).max) revert("uint128 overflow");
        return uint128(val);
    }

    function to104(uint256 val) internal pure returns (uint104) {
        if (val > type(uint104).max) revert("uint104 overflow");
        return uint104(val);
    }

    /// @notice Update the given pool's rewarder
    /// @param _pid the pool id
    /// @param _rewarder the rewarder
    function setRewarder(uint256 _pid, IRewarder _rewarder) external onlyOwner {
        require(Address.isContract(address(_rewarder)) || address(_rewarder) == address(0), "set: rewarder must be contract or zero");

        PoolInfoV3 storage pool = poolInfoV3[_pid];

        pool.rewarder = _rewarder;
        emit SetRewarder(_pid, _rewarder);
    }
}

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

pragma solidity ^0.8.0;

import "../utils/Context.sol";

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

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

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

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

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

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

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

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

File 3 of 15 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @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.
     */
    constructor() {
        _paused = false;
    }

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

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

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

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        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());
    }
}

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

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

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

pragma solidity ^0.8.0;

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly
                /// @solidity memory-safe-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

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

pragma solidity ^0.8.0;

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

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

File 10 of 15 : SafeMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 11 of 15 : EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)

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.
 *
 * [WARNING]
 * ====
 *  Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable.
 *  See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 *  In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet.
 * ====
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position 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;

        /// @solidity memory-safe-assembly
        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;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }
}

File 12 of 15 : IMasterBids.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.5;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

interface IMasterBids {
    function getAssetPid(address asset) external view returns (uint256 pid);

    function poolLength() external view returns (uint256);

    function pendingTokens(
        uint256 _pid,
        address _user
    ) external view returns (uint256 pendingRewards, uint256[] memory pendingRewarderRewards);

    function massUpdatePools() external;

    function updatePool(uint256 _pid) external;

    function deposit(uint256 _pid, uint256 _amount) external returns (uint256, uint256[] memory);

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

    function withdraw(uint256 _pid, uint256 _amount) external returns (uint256, uint256[] memory);

    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 _newVeWomBalance) external;

    function notifyRewardAmount(address _lpToken, uint256 _amount, uint256 _rewardDuration) external;
}

File 13 of 15 : IRewarder.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.5;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

interface IRewarder {
    function onReward(address _user) external returns (uint256[] memory rewards);

    function pendingTokens(address _user) external view returns (uint256[] memory rewards);
}

File 14 of 15 : IVeBids.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.5;

/**
 * @dev Interface of the VeBids
 */
interface IVeBids {
    
    struct Breeding {
        uint48 unlockTime;
        uint104 bidsAmount;
        uint104 veBIDSAmount;
    }

    struct UserInfo {
        Breeding[] breedings;
        uint256 userTotalBidsLocked;
    }

    function totalSupply() external view returns (uint256);

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

    function isUser(address _addr) external view returns (bool);

    function getUserOverview(address _addr) external view returns (uint256 womLocked, uint256 veWomBalance);

    function getUserInfo(address addr) external view returns (UserInfo memory);

    function mint(uint256 amount, uint256 lockDays) external returns (uint256 veWomAmount);

    function burn(uint256 slot) external;

    function update(uint256 slot, uint256 lockDays) external returns (uint256 newVeWomAmount);
}

File 15 of 15 : DSMath.sol
// SPDX-License-Identifier: GPL-3.0

/// math.sol -- mixin for inline numerical wizardry

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

pragma solidity ^0.8.5;

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

    // 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;
        }
    }

    // Babylonian Method with initial guess
    function sqrt(uint256 y, uint256 guess) internal pure returns (uint256 z) {
        if (y > 3) {
            if (guess > y || guess == 0) {
                z = y;
            } else {
                z = guess;
            }
            uint256 x = (y / z + z) / 2;
            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;
    }

    function wdiv(uint256 x, uint256 y) internal pure returns (uint256) {
        return ((x * WAD) + (y / 2)) / y;
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract IERC20","name":"_Bids","type":"address"},{"internalType":"contract IVeBids","name":"_veBids","type":"address"},{"internalType":"address","name":"_voter","type":"address"},{"internalType":"uint16","name":"_basePartition","type":"uint16"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":true,"internalType":"contract IERC20","name":"lpToken","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":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"balance","type":"uint256"}],"name":"EmergencyBidsWithdraw","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":false,"internalType":"address","name":"_newMaster","type":"address"}],"name":"NewMaster","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":"contract IRewarder","name":"rewarder","type":"address"}],"name":"SetRewarder","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":"basePartition","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"boostedPartition","type":"uint256"}],"name":"UpdateEmissionPartition","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"address","name":"oldVeBids","type":"address"},{"indexed":false,"internalType":"address","name":"newVeBids","type":"address"}],"name":"UpdateVeBids","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"address","name":"oldVoter","type":"address"},{"indexed":false,"internalType":"address","name":"newVoter","type":"address"},{"indexed":false,"internalType":"bool","name":"callable","type":"bool"}],"name":"UpdateVoter","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":[],"name":"ACC_TOKEN_PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"Bids","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_lpToken","type":"address"},{"internalType":"contract IRewarder","name":"_rewarder","type":"address"}],"name":"add","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"basePartition","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"boostedPartition","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"calRewardPerUnit","outputs":[{"internalType":"uint256","name":"accBidsPerShare","type":"uint256"},{"internalType":"uint256","name":"accBidsPerFactorShare","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":"reward","type":"uint256"},{"internalType":"uint256[]","name":"additionalRewards","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":"emergencyBidsWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"getAssetPid","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_periodFinish","type":"uint256"}],"name":"lastTimeRewardApplicable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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":"reward","type":"uint256"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"uint256[][]","name":"additionalRewards","type":"uint256[][]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"newMasterBids","outputs":[{"internalType":"contract IMasterBids","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_lpToken","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_rewardDuration","type":"uint256"}],"name":"notifyRewardAmount","outputs":[],"stateMutability":"nonpayable","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":"pendingRewards","type":"uint256"},{"internalType":"uint256[]","name":"pendingRewarderRewards","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_user","type":"address"}],"name":"pendingTokensSplit","outputs":[{"internalType":"uint256","name":"pendingBaseRewards","type":"uint256"},{"internalType":"uint256","name":"pendingFactorRewards","type":"uint256"},{"internalType":"uint256[]","name":"pendingRewarderRewards","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolInfoV3","outputs":[{"internalType":"contract IERC20","name":"lpToken","type":"address"},{"internalType":"contract IRewarder","name":"rewarder","type":"address"},{"internalType":"uint40","name":"periodFinish","type":"uint40"},{"internalType":"uint128","name":"sumOfFactors","type":"uint128"},{"internalType":"uint128","name":"rewardRate","type":"uint128"},{"internalType":"uint104","name":"accBidsPerShare","type":"uint104"},{"internalType":"uint104","name":"accBidsPerFactorShare","type":"uint104"},{"internalType":"uint40","name":"lastRewardTimestamp","type":"uint40"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IMasterBids","name":"_newMasterBids","type":"address"}],"name":"setNewMasterBids","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"contract IRewarder","name":"_rewarder","type":"address"}],"name":"setRewarder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IVeBids","name":"_newVeBids","type":"address"}],"name":"setVeBids","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newVoter","type":"address"},{"internalType":"bool","name":"_voterIsCallable","type":"bool"}],"name":"setVoter","outputs":[],"stateMutability":"nonpayable","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":"uint16","name":"_basePartition","type":"uint16"}],"name":"updateEmissionPartition","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_newVeBidsBalance","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":"uint128","name":"amount","type":"uint128"},{"internalType":"uint128","name":"factor","type":"uint128"},{"internalType":"uint128","name":"rewardDebt","type":"uint128"},{"internalType":"uint128","name":"pendingBids","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"veBids","outputs":[{"internalType":"contract IVeBids","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"voter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"voterIsCallable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"reward","type":"uint256"},{"internalType":"uint256[]","name":"additionalRewards","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b5060405162003df338038062003df3833981016040819052620000349162000292565b6200003f3362000229565b600180556002805460ff191690556001600160a01b038416620000a95760405162461bcd60e51b815260206004820152601b60248201527f4269647320616464726573732063616e6e6f74206265207a65726f000000000060448201526064015b60405180910390fd5b6001600160a01b038316620001015760405162461bcd60e51b815260206004820152601d60248201527f56654269647320616464726573732063616e6e6f74206265207a65726f0000006044820152606401620000a0565b6001600160a01b038216620001595760405162461bcd60e51b815260206004820152601c60248201527f566f74657220616464726573732063616e6e6f74206265207a65726f000000006044820152606401620000a0565b6103e88161ffff161115620001c15760405162461bcd60e51b815260206004820152602760248201527f6261736520706172746974696f6e206d75737420626520696e2072616e6765206044820152660302c20313030360cc1b6064820152608401620000a0565b60028054610100600160a81b0319166101006001600160a01b0396871602179055600380546001600160a01b031916938516939093179092556005805491909316600162ffff0160a01b031990911617600160a81b61ffff9092169190910217905562000300565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146200028f57600080fd5b50565b60008060008060808587031215620002a957600080fd5b8451620002b68162000279565b6020860151909450620002c98162000279565b6040860151909350620002dc8162000279565b606086015190925061ffff81168114620002f557600080fd5b939692955090935050565b613ae380620003106000396000f3fe608060405234801561001057600080fd5b506004361061023d5760003560e01c80638456cb591161013b578063be159bea116100b8578063eea016041161007c578063eea01604146105e7578063eeca1562146105f3578063f2fde38b14610606578063ff75f44914610619578063ffcd42631461062157600080fd5b8063be159bea14610593578063d93bf4fe1461059b578063da9d1201146105ae578063e1f174fb146105c1578063e2bbb158146105d457600080fd5b8063abfef111116100ff578063abfef111146104a2578063af929a80146104ca578063b163e793146104dd578063b4e80c2b14610558578063b8be44e71461056b57600080fd5b80638456cb59146103de5780638da5cb5b146103e657806390210d7e146103f757806393f1a40b1461040a578063a3cd8ac41461048f57600080fd5b80634f00a93e116101c9578063630b5ba11161018d578063630b5ba11461038f5780636cdc1982146103975780636ed79be1146103aa578063715018a6146103c25780637f0b81fe146103ca57600080fd5b80634f00a93e1461032c57806351eb05a61461033f57806352c28fab146103525780635312ea8e146103655780635c975abb1461037857600080fd5b806343de32071161021057806343de320714610298578063441a3e70146102ab57806346c96aac146102cc578063488ba650146102f75780634ed73d281461030a57600080fd5b8063081e3eda146102425780631983dbf5146102595780631c97a0941461026e5780633f4ba83a14610290575b600080fd5b6008545b6040519081526020015b60405180910390f35b61026c610267366004613455565b610634565b005b61028161027c36600461348e565b6106c1565b604051610250939291906134f9565b61026c61095c565b61026c6102a636600461348e565b61096e565b6102be6102b9366004613521565b610a77565b604051610250929190613543565b6005546102df906001600160a01b031681565b6040516001600160a01b039091168152602001610250565b6004546102df906001600160a01b031681565b61031d61031836600461355c565b610bcf565b604051610250939291906135d1565b61026c61033a366004613670565b610c51565b61026c61034d36600461369c565b610f31565b61026c6103603660046136b5565b610f3d565b61026c61037336600461369c565b611295565b60025460ff165b6040519015158152602001610250565b61026c611447565b61026c6103a53660046136e3565b611472565b6002546102df9061010090046001600160a01b031681565b61026c6114f0565b60055461037f90600160a01b900460ff1681565b61026c611502565b6000546001600160a01b03166102df565b61026c610405366004613700565b611512565b61045c61041836600461348e565b6009602090815260009283526040808420909152908252902080546001909101546001600160801b0380831692600160801b90819004821692808316929190041684565b604080516001600160801b0395861681529385166020850152918416918301919091529091166060820152608001610250565b61026c61049d366004613739565b611616565b6005546104b790600160a81b900461ffff1681565b60405161ffff9091168152602001610250565b6102466104d83660046136e3565b611858565b6104f06104eb36600461369c565b611883565b604080516001600160a01b03998a16815298909716602089015264ffffffffff958616968801969096526001600160801b0393841660608801529290911660808601526001600160681b0390811660a08601521660c08401521660e082015261010001610250565b6003546102df906001600160a01b031681565b61057e61057936600461369c565b611910565b60408051928352602083019190915201610250565b610246611b2b565b61026c6105a936600461355c565b611b51565b61026c6105bc3660046136e3565b611e76565b61026c6105cf36600461377c565b611ed2565b6102be6105e2366004613521565b611fa1565b61024664e8d4a5100081565b61024661060136600461369c565b612088565b61026c6106143660046136e3565b61209e565b61026c612114565b6102be61062f36600461348e565b612263565b61063c612482565b6103e88161ffff16111561064f57600080fd5b610657611447565b6005805461ffff60a81b1916600160a81b61ffff841602179055337f7fd921cf733c788915a229b0ea58095c44ae2c275ed7835501e5135fe3c1ed05826106a0816103e86137c0565b6040805161ffff93841681529290911660208301520160405180910390a250565b60008060606000600886815481106106db576106db6137e2565b600091825260208083206040805161010081018252600490940290910180546001600160a01b03908116855260018201549081169385019390935264ffffffffff600160a01b90930483169184019190915260028101546001600160801b038082166060860152600160801b909104166080840152600301546001600160681b0380821660a0850152600160681b82041660c0840152600160d01b90041660e082015291508061078a88611910565b60008a81526009602090815260408083206001600160a01b03808e16855290835292819020815160808101835281546001600160801b038082168352600160801b9182900481168387015260019093015480841694830194909452909204166060820152908701519395509193509091161561087757602084015160405163c031a66f60e01b81526001600160a01b038a811660048301529091169063c031a66f90602401600060405180830381865afa15801561084c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610874919081019061380e565b94505b80516001600160801b0316600003610899576000809650965050505050610955565b80516000906108b29085906001600160801b03166138cc565b905060008383602001516001600160801b03166108cf91906138cc565b9050600083604001516001600160801b031684606001516001600160801b031664e8d4a51000848661090191906138e3565b61090b91906138f6565b61091591906138e3565b61091f9190613918565b905061092b82846138e3565b61093583836138cc565b61093f91906138f6565b985061094b8982613918565b9950505050505050505b9250925092565b610964612482565b61096c6124dc565b565b610976612482565b6001600160a01b0381163b15158061099557506001600160a01b038116155b6109f55760405162461bcd60e51b815260206004820152602660248201527f7365743a207265776172646572206d75737420626520636f6e7472616374206f60448201526572207a65726f60d01b60648201526084015b60405180910390fd5b600060088381548110610a0a57610a0a6137e2565b60009182526020918290206004909102016001810180546001600160a01b0319166001600160a01b03861690811790915560405190815290925084917f858b2cab7b344488967106b3c498c1f59de0a26b500923d9e4e06918909cd51191015b60405180910390a2505050565b60006060600260015403610a9d5760405162461bcd60e51b81526004016109ec9061392b565b6002600155610aaa612529565b600060088581548110610abf57610abf6137e2565b6000918252602080832088845260098252604080852033865290925292208054600490920290920192506001600160801b0316851115610b415760405162461bcd60e51b815260206004820152601c60248201527f77697468647261773a206e6f7420656e6f7567682062616c616e63650000000060448201526064016109ec565b610b4a8661256f565b8054610b6d9087903390610b689089906001600160801b0316613918565b6126ef565b83549195509350610b88906001600160a01b03163387612ac8565b604051858152869033907ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b568906020015b60405180910390a350506001805590939092509050565b6000606080600260015403610bf65760405162461bcd60e51b81526004016109ec9061392b565b6002600155610c03612529565b610c3f858580806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250612b3092505050565b60018055919790965090945092505050565b6003546001600160a01b03163314610cab5760405162461bcd60e51b815260206004820181905260248201527f4d6173746572426964733a2063616c6c6572206973206e6f742056654269647360448201526064016109ec565b60085460005b81811015610f2b5760008181526009602090815260408083206001600160a01b03881684529091528120805490916001600160801b039091169003610cf65750610f1b565b610cff8261256f565b600060088381548110610d1457610d146137e2565b600091825260208220600185015460049290920201600381015485549194506001600160801b039283169264e8d4a5100092610d6992600160681b90046001600160681b031691600160801b909104166138cc565b60038501548654610d8c916001600160681b0316906001600160801b03166138cc565b610d9691906138e3565b610da091906138f6565b610daa9190613918565b9050610db581612f3c565b600184018054601090610dd9908490600160801b90046001600160801b0316613962565b82546101009290920a6001600160801b038181021990931691831602179091558454600160801b810482169250600091610e2991610e19918b91166138cc565b86546001600160801b0316612f8c565b9050610e3481612f3c565b85546001600160801b03918216600160801b0291161785556003840154610eb39064e8d4a5100090610e77906001600160681b03600160681b90910416846138cc565b60038701548854610e9a916001600160681b0316906001600160801b03166138cc565b610ea491906138e3565b610eae91906138f6565b612f3c565b6001860180546001600160801b0319166001600160801b039283161790556002850154610ef2918491610ee8918591166138e3565b610eae9190613918565b60029490940180546001600160801b0319166001600160801b0390951694909417909355505050505b610f2481613982565b9050610cb1565b50505050565b610f3a8161256f565b50565b610f45612482565b6001600160a01b0382163b610fab5760405162461bcd60e51b815260206004820152602660248201527f6164643a204c5020746f6b656e206d75737420626520612076616c696420636f6044820152651b9d1c9858dd60d21b60648201526084016109ec565b610fb660068361301f565b15610ffb5760405162461bcd60e51b81526020600482015260156024820152741859190e88131408185b1c9958591e481859191959605a1b60448201526064016109ec565b6008604051806101000160405280846001600160a01b03168152602001836001600160a01b031681526020014264ffffffffff16815260200160006001600160801b0316815260200160006001600160801b0316815260200160006001600160681b0316815260200160006001600160681b031681526020014264ffffffffff16815250908060018154018082558091505060019003906000526020600020906004020160009091909190915060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060208201518160010160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160010160146101000a81548164ffffffffff021916908364ffffffffff16021790555060608201518160020160006101000a8154816001600160801b0302191690836001600160801b0316021790555060808201518160020160106101000a8154816001600160801b0302191690836001600160801b0316021790555060a08201518160030160006101000a8154816001600160681b0302191690836001600160681b0316021790555060c082015181600301600d6101000a8154816001600160681b0302191690836001600160681b0316021790555060e082015181600301601a6101000a81548164ffffffffff021916908364ffffffffff1602179055505050600880549050600a6000846001600160a01b03166001600160a01b031681526020019081526020016000208190555061124d82600661304490919063ffffffff16565b506008546001600160a01b0383169061126890600190613918565b6040517f1c482cb20f653d55406cc8aa89ebf482b8603c0ffebcf7e6182ff8ac1849d12d90600090a35050565b6002600154036112b75760405162461bcd60e51b81526004016109ec9061392b565b60026001819055506000600882815481106112d4576112d46137e2565b60009182526020808320858452600982526040808520338087529352909320805460049093029093018054909450611322926001600160a01b039190911691906001600160801b0316612ac8565b80546002830154611346916001600160801b03600160801b9091048116911661399b565b6002830180546001600160801b03929092166001600160801b031992831617905560008255600182810180549092169091558201546001600160a01b031680156113fa57604051636339720b60e11b81523360048201526001600160a01b0382169063c672e416906024016000604051808303816000875af11580156113d0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526113f8919081019061380e565b505b81546040516001600160801b039091168152849033907fbb757047c2b5f3974fe26b7c10f732e7bce710b0952a71082702781e62ae05959060200160405180910390a35050600180555050565b60085460005b8181101561146e5761145e8161256f565b61146781613982565b905061144d565b5050565b61147a612482565b6001600160a01b03811661148d57600080fd5b600380546001600160a01b038381166001600160a01b0319831681179093556040805191909216808252602082019390935233917fd5088813ba340c1c414c28daa5aec546d4c3c8061847176a15e45065ad61f62b910160405180910390a25050565b6114f8612482565b61096c6000613059565b61150a612482565b61096c6130a9565b6002600154036115345760405162461bcd60e51b81526004016109ec9061392b565b6002600155611541612529565b600060088481548110611556576115566137e2565b600091825260208083208784526009825260408085206001600160a01b03881686529092529220600490910290910191506115908561256f565b80546115ae9086908590610b689088906001600160801b03166138e3565b505081546115c7906001600160a01b03163330876130e6565b84836001600160a01b03167f16f3fbfd4bcc50a5cecb2e53e398a1ad77d89f63288ef540d862b264ed57eb1f8660405161160391815260200190565b60405180910390a3505060018055505050565b6005546001600160a01b031633146116705760405162461bcd60e51b815260206004820152601f60248201527f4d6173746572426964733a2063616c6c6572206973206e6f7420566f7465720060448201526064016109ec565b600082116116c05760405162461bcd60e51b815260206004820152601f60248201527f6e6f74696679526577617264416d6f756e743a207a65726f20616d6f756e740060448201526064016109ec565b6001600160a01b0383166000908152600a60205260408120546116e590600190613918565b90506000600882815481106116fc576116fc6137e2565b6000918252602090912060049091020160018101546003820154919250600160a01b900464ffffffffff908116600160d01b909204161061176857611744610eae84866138f6565b6002820180546001600160801b03928316600160801b0292169190911790556117f8565b600381015460018201546000916117989164ffffffffff600160d01b909204821691600160a01b909104166139bb565b600283015464ffffffffff9190911691506000906117c690600160801b90046001600160801b0316836138cc565b90506117d685610ea483896138e3565b6002840180546001600160801b03928316600160801b02921691909117905550505b60038101805464ffffffffff42908116600160d01b0264ffffffffff60d01b199092169190911790915561182d9084906138e3565b8160010160146101000a81548164ffffffffff021916908364ffffffffff1602179055505050505050565b6001600160a01b0381166000908152600a602052604081205461187d90600190613918565b92915050565b6008818154811061189357600080fd5b600091825260209091206004909102018054600182015460028301546003909301546001600160a01b0392831694509181169264ffffffffff600160a01b9092048216926001600160801b0380831693600160801b90930416916001600160681b0380831692600160681b810490911691600160d01b9091041688565b600080600060088481548110611928576119286137e2565b60009182526020822060049182020180546040516370a0823160e01b815230938101939093529093506001600160a01b0316906370a0823190602401602060405180830381865afa158015611981573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119a591906139d9565b60038301546001600160681b038082169650600160681b90910416935090508015806119e357506003820154600160d01b900464ffffffffff164211155b156119ef575050915091565b6003820154600183015460009164ffffffffff600160d01b909104811691611a1f91600160a01b90910416612088565b611a299190613918565b6002840154909150600090611a4e90600160801b90046001600160801b0316836138cc565b9050611a5c836103e86138cc565b600554600160a81b900461ffff16611a7964e8d4a51000846138cc565b611a8391906138cc565b611a8d91906138f6565b611a9790876138e3565b60028501549096506001600160801b031615611b22576002840154611ac7906001600160801b03166103e86139f2565b6001600160801b0316600560159054906101000a900461ffff166103e8611aee91906137c0565b61ffff16611b0164e8d4a51000846138cc565b611b0b91906138cc565b611b1591906138f6565b611b1f90866138e3565b94505b50505050915091565b600554600090611b4890600160a81b900461ffff166103e86137c0565b61ffff16905090565b600260015403611b735760405162461bcd60e51b81526004016109ec9061392b565b60026001556004546001600160a01b0316611bbc5760405162461bcd60e51b8152602060048201526009602482015268746f2077686572653f60b81b60448201526064016109ec565b611bf8828280806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250612b3092505050565b50505060005b81811015611e6d576000838383818110611c1a57611c1a6137e2565b602090810292909201356000818152600984526040808220338352909452929092208054929350916001600160801b0316159050611e5a57600060088381548110611c6757611c676137e2565b6000918252602090912060049182020180548254855460405163095ea7b360e01b81526001600160a01b03928316958101959095526001600160801b03166024850152919350169063095ea7b3906044016020604051808303816000875af1158015611cd7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cfb9190613a1d565b5060048054825460405163015f253560e71b81526001600160a01b039182169381019390935260009291169063af929a8090602401602060405180830381865afa158015611d4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d7191906139d9565b60048054855460405163481086bf60e11b81529283018490526001600160801b031660248301523360448301529192506001600160a01b03909116906390210d7e90606401600060405180830381600087803b158015611dd057600080fd5b505af1158015611de4573d6000803e3d6000fd5b505084546002850180546001600160801b03600160801b90930483169450909250600091611e149185911661399b565b82546001600160801b039182166101009390930a928302919092021990911617905550505060008281526009602090815260408083203384529091528120818155600101555b505080611e6690613982565b9050611bfe565b50506001805550565b611e7e612482565b600480546001600160a01b0319166001600160a01b0383169081179091556040519081527f92bc900c329289b9238e9a0b2e7e81d9e54e89dd939e2e0457888cfd331758869060200160405180910390a150565b611eda612482565b6001600160a01b038216611f305760405162461bcd60e51b815260206004820152601c60248201527f566f74657220616464726573732063616e6e6f74206265207a65726f0000000060448201526064016109ec565b60058054821515600160a01b81026001600160a81b031983166001600160a01b0387811691821792909217909455604080519190931680825260208201949094529182015233907fe69f0c141e47e9c00220eb7acfd9d9f4070e94a83943d1bec72108f8984f79f790606001610a6a565b60006060600260015403611fc75760405162461bcd60e51b81526004016109ec9061392b565b6002600155611fd4612529565b600060088581548110611fe957611fe96137e2565b6000918252602080832088845260098252604080852033865290925292206004909102909101915061201a8661256f565b80546120389087903390610b689089906001600160801b03166138e3565b83549195509350612054906001600160a01b03163330886130e6565b604051858152869033907f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a1590602001610bb8565b6000814210612097578161187d565b4292915050565b6120a6612482565b6001600160a01b03811661210b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016109ec565b610f3a81613059565b61211c612482565b6002546040516370a0823160e01b81523060048201526121aa9133916101009091046001600160a01b0316906370a0823190602401602060405180830381865afa15801561216e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061219291906139d9565b60025461010090046001600160a01b03169190612ac8565b6002546040516370a0823160e01b81523060048201527fbe9e33d7d1f0da682ee217a5a86acace89e901f93aa3ff5c6a501d9b5b379a279133916101009091046001600160a01b0316906370a0823190602401602060405180830381865afa15801561221a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061223e91906139d9565b604080516001600160a01b0390931683526020830191909152015b60405180910390a1565b6000606060006008858154811061227c5761227c6137e2565b600091825260208083206040805161010081018252600490940290910180546001600160a01b03908116855260018201549081169385019390935264ffffffffff600160a01b90930483169184019190915260028101546001600160801b038082166060860152600160801b909104166080840152600301546001600160681b0380821660a0850152600160681b82041660c0840152600160d01b90041660e082015291508061232b87611910565b60008981526009602090815260408083206001600160a01b038c168452825291829020825160808101845281546001600160801b038082168352600160801b91829004811694830185905260019093015480841695830186905204909116606082018190529496509294509192909164e8d4a51000906123ac9086906138cc565b84516123c29088906001600160801b03166138cc565b6123cc91906138e3565b6123d691906138f6565b6123e091906138e3565b6123ea9190613918565b60208501519096506001600160a01b03161561247757602084015160405163c031a66f60e01b81526001600160a01b0389811660048301529091169063c031a66f90602401600060405180830381865afa15801561244c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612474919081019061380e565b94505b505050509250929050565b6000546001600160a01b0316331461096c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016109ec565b6124e461311e565b6002805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b039091168152602001612259565b60025460ff161561096c5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016109ec565b600060088281548110612584576125846137e2565b9060005260206000209060040201905080600301601a9054906101000a900464ffffffffff1664ffffffffff16421115612679576000806125c484611910565b915091506125d182613167565b6003840180546cffffffffffffffffffffffffff19166001600160681b039290921691909117905561260281613167565b6003840180546001600160681b0392909216600160681b026cffffffffffffffffffffffffff60681b1990921691909117905560018301546126529064ffffffffff600160a01b90910416612088565b83600301601a6101000a81548164ffffffffff021916908364ffffffffff16021790555050505b600554600160a01b900460ff161561146e5760055481546040516363453ae160e01b81526001600160a01b0391821660048201529116906363453ae190602401600060405180830381600087803b1580156126d357600080fd5b505af11580156126e7573d6000803e3d6000fd5b505050505050565b60006060600060088681548110612708576127086137e2565b600091825260208083208984526009825260408085206001600160a01b038b16865290925292208054600490920290920192506001600160801b031615158061276457506001810154600160801b90046001600160801b031615155b15612872576001810154600383015482546001600160801b0380841693600160801b9081900482169364e8d4a51000936127b293600160681b9092046001600160681b0316929004166138cc565b600386015485546127d5916001600160681b0316906001600160801b03166138cc565b6127df91906138e3565b6127e991906138f6565b6127f391906138e3565b6127fd9190613918565b6001820180546001600160801b0316905560025490945061282d9061010090046001600160a01b03168786612ac8565b86866001600160a01b03167f71bab65ced2e5750775a0613be067df48ef06cf92a496ebf7663ae06609249548660405161286991815260200190565b60405180910390a35b61287b85612f3c565b81546001600160801b0319166001600160801b03918216178083556003546040516370a0823160e01b81526001600160a01b038a81166004830152600160801b9093049093169261293b92610eae9216906370a0823190602401602060405180830381865afa1580156128f2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061291691906139d9565b845461292b91906001600160801b03166138cc565b84546001600160801b0316612f8c565b82546001600160801b03908116600160801b92821683021780855560038601546129a99364e8d4a510009361298693600160681b9093046001600160681b03169291909104166138cc565b60038601548554610e9a916001600160681b0316906001600160801b03166138cc565b600183810180546001600160801b0319166001600160801b0393909316929092179091558301546001600160a01b03168015612a5257604051636339720b60e11b81526001600160a01b03898116600483015282169063c672e416906024016000604051808303816000875af1158015612a27573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612a4f919081019061380e565b94505b82546002850154612a94918491612a7c916001600160801b03600160801b90910481169116613962565b612a86919061399b565b6001600160801b0316612f3c565b8460020160006101000a8154816001600160801b0302191690836001600160801b0316021790555050505050935093915050565b6040516001600160a01b038316602482015260448101829052612b2b90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526131b3565b505050565b6000606080835167ffffffffffffffff811115612b4f57612b4f6137f8565b604051908082528060200260200182016040528015612b78578160200160208202803683370190505b509150835167ffffffffffffffff811115612b9557612b956137f8565b604051908082528060200260200182016040528015612bc857816020015b6060815260200190600190039081612bb35790505b50905060005b8451811015612f1857600060096000878481518110612bef57612bef6137e2565b602002602001015181526020019081526020016000206000336001600160a01b03166001600160a01b031681526020019081526020016000209050612c4c868381518110612c3f57612c3f6137e2565b602002602001015161256f565b80546001600160801b031615612f075760006008878481518110612c7257612c726137e2565b602002602001015181548110612c8a57612c8a6137e2565b600091825260208220600185015460049290920201600381015485549194506001600160801b0380841693600160801b9081900482169364e8d4a5100093612ce793600160681b9091046001600160681b031692909104166138cc565b60038601548754612d0a916001600160681b0316906001600160801b03166138cc565b612d1491906138e3565b612d1e91906138f6565b612d2891906138e3565b612d329190613918565b6001840180546001600160801b0390811690915560038401548554929350612da09264e8d4a5100092612d7d92600160681b90046001600160681b031691600160801b9004166138cc565b60038501548654610e9a916001600160681b0316906001600160801b03166138cc565b6001840180546001600160801b0319166001600160801b0392909216919091179055612dcc81886138e3565b965080868581518110612de157612de16137e2565b602002602001018181525050878481518110612dff57612dff6137e2565b6020026020010151336001600160a01b03167f71bab65ced2e5750775a0613be067df48ef06cf92a496ebf7663ae0660924954888781518110612e4457612e446137e2565b6020026020010151604051612e5b91815260200190565b60405180910390a360018201546001600160a01b03168015612f0357604051636339720b60e11b81523360048201526001600160a01b0382169063c672e416906024016000604051808303816000875af1158015612ebd573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612ee5919081019061380e565b868681518110612ef757612ef76137e2565b60200260200101819052505b5050505b50612f1181613982565b9050612bce565b50600254612f359061010090046001600160a01b03163385612ac8565b9193909250565b60006001600160801b03821115612f885760405162461bcd60e51b815260206004820152601060248201526f75696e74313238206f766572666c6f7760801b60448201526064016109ec565b5090565b600060038311156130105782821180612fa3575081155b15612faf575081612fb2565b50805b6000600282612fc181876138f6565b612fcb91906138e3565b612fd591906138f6565b90505b81811461300a57905080600281612fef81876138f6565b612ff991906138e3565b61300391906138f6565b9050612fd8565b5061187d565b821561187d5750600192915050565b6001600160a01b038116600090815260018301602052604081205415155b9392505050565b600061303d836001600160a01b038416613285565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6130b1612529565b6002805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586125113390565b6040516001600160a01b0380851660248301528316604482015260648101829052610f2b9085906323b872dd60e01b90608401612af4565b60025460ff1661096c5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016109ec565b60006001600160681b03821115612f885760405162461bcd60e51b815260206004820152601060248201526f75696e74313034206f766572666c6f7760801b60448201526064016109ec565b6000613208826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166132d49092919063ffffffff16565b805190915015612b2b57808060200190518101906132269190613a1d565b612b2b5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016109ec565b60008181526001830160205260408120546132cc5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561187d565b50600061187d565b60606132e384846000856132eb565b949350505050565b60608247101561334c5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016109ec565b6001600160a01b0385163b6133a35760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016109ec565b600080866001600160a01b031685876040516133bf9190613a5e565b60006040518083038185875af1925050503d80600081146133fc576040519150601f19603f3d011682016040523d82523d6000602084013e613401565b606091505b509150915061341182828661341c565b979650505050505050565b6060831561342b57508161303d565b82511561343b5782518084602001fd5b8160405162461bcd60e51b81526004016109ec9190613a7a565b60006020828403121561346757600080fd5b813561ffff8116811461303d57600080fd5b6001600160a01b0381168114610f3a57600080fd5b600080604083850312156134a157600080fd5b8235915060208301356134b381613479565b809150509250929050565b600081518084526020808501945080840160005b838110156134ee578151875295820195908201906001016134d2565b509495945050505050565b83815282602082015260606040820152600061351860608301846134be565b95945050505050565b6000806040838503121561353457600080fd5b50508035926020909101359150565b8281526040602082015260006132e360408301846134be565b6000806020838503121561356f57600080fd5b823567ffffffffffffffff8082111561358757600080fd5b818501915085601f83011261359b57600080fd5b8135818111156135aa57600080fd5b8660208260051b85010111156135bf57600080fd5b60209290920196919550909350505050565b838152600060206060818401526135eb60608401866134be565b8381036040850152845180825282820190600581901b830184018488016000805b8481101561365f57868403601f19018652825180518086529089019089860190845b8181101561364a5783518352928b0192918b019160010161362e565b5050968901969450509187019160010161360c565b50919b9a5050505050505050505050565b6000806040838503121561368357600080fd5b823561368e81613479565b946020939093013593505050565b6000602082840312156136ae57600080fd5b5035919050565b600080604083850312156136c857600080fd5b82356136d381613479565b915060208301356134b381613479565b6000602082840312156136f557600080fd5b813561303d81613479565b60008060006060848603121561371557600080fd5b8335925060208401359150604084013561372e81613479565b809150509250925092565b60008060006060848603121561374e57600080fd5b833561375981613479565b95602085013595506040909401359392505050565b8015158114610f3a57600080fd5b6000806040838503121561378f57600080fd5b823561379a81613479565b915060208301356134b38161376e565b634e487b7160e01b600052601160045260246000fd5b61ffff8281168282160390808211156137db576137db6137aa565b5092915050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561382157600080fd5b825167ffffffffffffffff8082111561383957600080fd5b818501915085601f83011261384d57600080fd5b81518181111561385f5761385f6137f8565b8060051b604051601f19603f83011681018181108582111715613884576138846137f8565b6040529182528482019250838101850191888311156138a257600080fd5b938501935b828510156138c0578451845293850193928501926138a7565b98975050505050505050565b808202811582820484141761187d5761187d6137aa565b8082018082111561187d5761187d6137aa565b60008261391357634e487b7160e01b600052601260045260246000fd5b500490565b8181038181111561187d5761187d6137aa565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6001600160801b038181168382160190808211156137db576137db6137aa565b600060018201613994576139946137aa565b5060010190565b6001600160801b038281168282160390808211156137db576137db6137aa565b64ffffffffff8281168282160390808211156137db576137db6137aa565b6000602082840312156139eb57600080fd5b5051919050565b6001600160801b03818116838216028082169190828114613a1557613a156137aa565b505092915050565b600060208284031215613a2f57600080fd5b815161303d8161376e565b60005b83811015613a55578181015183820152602001613a3d565b50506000910152565b60008251613a70818460208701613a3a565b9190910192915050565b6020815260008251806020840152613a99816040850160208701613a3a565b601f01601f1916919091016040019291505056fea2646970667358221220c33072a87811e723525236e4ea2037ac2f24a1b5e40cb1e953e5c314ca9173a464736f6c63430008130033000000000000000000000000a53e968b8d8a5be52d66e5bb35d9b6b6b5a5cd2f00000000000000000000000043949399d34f8b61a899581575b5259b36f418d00000000000000000000000002d9d2d78b2a5978f00e0df6addf954da9b3779f1000000000000000000000000000000000000000000000000000000000000012c

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061023d5760003560e01c80638456cb591161013b578063be159bea116100b8578063eea016041161007c578063eea01604146105e7578063eeca1562146105f3578063f2fde38b14610606578063ff75f44914610619578063ffcd42631461062157600080fd5b8063be159bea14610593578063d93bf4fe1461059b578063da9d1201146105ae578063e1f174fb146105c1578063e2bbb158146105d457600080fd5b8063abfef111116100ff578063abfef111146104a2578063af929a80146104ca578063b163e793146104dd578063b4e80c2b14610558578063b8be44e71461056b57600080fd5b80638456cb59146103de5780638da5cb5b146103e657806390210d7e146103f757806393f1a40b1461040a578063a3cd8ac41461048f57600080fd5b80634f00a93e116101c9578063630b5ba11161018d578063630b5ba11461038f5780636cdc1982146103975780636ed79be1146103aa578063715018a6146103c25780637f0b81fe146103ca57600080fd5b80634f00a93e1461032c57806351eb05a61461033f57806352c28fab146103525780635312ea8e146103655780635c975abb1461037857600080fd5b806343de32071161021057806343de320714610298578063441a3e70146102ab57806346c96aac146102cc578063488ba650146102f75780634ed73d281461030a57600080fd5b8063081e3eda146102425780631983dbf5146102595780631c97a0941461026e5780633f4ba83a14610290575b600080fd5b6008545b6040519081526020015b60405180910390f35b61026c610267366004613455565b610634565b005b61028161027c36600461348e565b6106c1565b604051610250939291906134f9565b61026c61095c565b61026c6102a636600461348e565b61096e565b6102be6102b9366004613521565b610a77565b604051610250929190613543565b6005546102df906001600160a01b031681565b6040516001600160a01b039091168152602001610250565b6004546102df906001600160a01b031681565b61031d61031836600461355c565b610bcf565b604051610250939291906135d1565b61026c61033a366004613670565b610c51565b61026c61034d36600461369c565b610f31565b61026c6103603660046136b5565b610f3d565b61026c61037336600461369c565b611295565b60025460ff165b6040519015158152602001610250565b61026c611447565b61026c6103a53660046136e3565b611472565b6002546102df9061010090046001600160a01b031681565b61026c6114f0565b60055461037f90600160a01b900460ff1681565b61026c611502565b6000546001600160a01b03166102df565b61026c610405366004613700565b611512565b61045c61041836600461348e565b6009602090815260009283526040808420909152908252902080546001909101546001600160801b0380831692600160801b90819004821692808316929190041684565b604080516001600160801b0395861681529385166020850152918416918301919091529091166060820152608001610250565b61026c61049d366004613739565b611616565b6005546104b790600160a81b900461ffff1681565b60405161ffff9091168152602001610250565b6102466104d83660046136e3565b611858565b6104f06104eb36600461369c565b611883565b604080516001600160a01b03998a16815298909716602089015264ffffffffff958616968801969096526001600160801b0393841660608801529290911660808601526001600160681b0390811660a08601521660c08401521660e082015261010001610250565b6003546102df906001600160a01b031681565b61057e61057936600461369c565b611910565b60408051928352602083019190915201610250565b610246611b2b565b61026c6105a936600461355c565b611b51565b61026c6105bc3660046136e3565b611e76565b61026c6105cf36600461377c565b611ed2565b6102be6105e2366004613521565b611fa1565b61024664e8d4a5100081565b61024661060136600461369c565b612088565b61026c6106143660046136e3565b61209e565b61026c612114565b6102be61062f36600461348e565b612263565b61063c612482565b6103e88161ffff16111561064f57600080fd5b610657611447565b6005805461ffff60a81b1916600160a81b61ffff841602179055337f7fd921cf733c788915a229b0ea58095c44ae2c275ed7835501e5135fe3c1ed05826106a0816103e86137c0565b6040805161ffff93841681529290911660208301520160405180910390a250565b60008060606000600886815481106106db576106db6137e2565b600091825260208083206040805161010081018252600490940290910180546001600160a01b03908116855260018201549081169385019390935264ffffffffff600160a01b90930483169184019190915260028101546001600160801b038082166060860152600160801b909104166080840152600301546001600160681b0380821660a0850152600160681b82041660c0840152600160d01b90041660e082015291508061078a88611910565b60008a81526009602090815260408083206001600160a01b03808e16855290835292819020815160808101835281546001600160801b038082168352600160801b9182900481168387015260019093015480841694830194909452909204166060820152908701519395509193509091161561087757602084015160405163c031a66f60e01b81526001600160a01b038a811660048301529091169063c031a66f90602401600060405180830381865afa15801561084c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610874919081019061380e565b94505b80516001600160801b0316600003610899576000809650965050505050610955565b80516000906108b29085906001600160801b03166138cc565b905060008383602001516001600160801b03166108cf91906138cc565b9050600083604001516001600160801b031684606001516001600160801b031664e8d4a51000848661090191906138e3565b61090b91906138f6565b61091591906138e3565b61091f9190613918565b905061092b82846138e3565b61093583836138cc565b61093f91906138f6565b985061094b8982613918565b9950505050505050505b9250925092565b610964612482565b61096c6124dc565b565b610976612482565b6001600160a01b0381163b15158061099557506001600160a01b038116155b6109f55760405162461bcd60e51b815260206004820152602660248201527f7365743a207265776172646572206d75737420626520636f6e7472616374206f60448201526572207a65726f60d01b60648201526084015b60405180910390fd5b600060088381548110610a0a57610a0a6137e2565b60009182526020918290206004909102016001810180546001600160a01b0319166001600160a01b03861690811790915560405190815290925084917f858b2cab7b344488967106b3c498c1f59de0a26b500923d9e4e06918909cd51191015b60405180910390a2505050565b60006060600260015403610a9d5760405162461bcd60e51b81526004016109ec9061392b565b6002600155610aaa612529565b600060088581548110610abf57610abf6137e2565b6000918252602080832088845260098252604080852033865290925292208054600490920290920192506001600160801b0316851115610b415760405162461bcd60e51b815260206004820152601c60248201527f77697468647261773a206e6f7420656e6f7567682062616c616e63650000000060448201526064016109ec565b610b4a8661256f565b8054610b6d9087903390610b689089906001600160801b0316613918565b6126ef565b83549195509350610b88906001600160a01b03163387612ac8565b604051858152869033907ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b568906020015b60405180910390a350506001805590939092509050565b6000606080600260015403610bf65760405162461bcd60e51b81526004016109ec9061392b565b6002600155610c03612529565b610c3f858580806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250612b3092505050565b60018055919790965090945092505050565b6003546001600160a01b03163314610cab5760405162461bcd60e51b815260206004820181905260248201527f4d6173746572426964733a2063616c6c6572206973206e6f742056654269647360448201526064016109ec565b60085460005b81811015610f2b5760008181526009602090815260408083206001600160a01b03881684529091528120805490916001600160801b039091169003610cf65750610f1b565b610cff8261256f565b600060088381548110610d1457610d146137e2565b600091825260208220600185015460049290920201600381015485549194506001600160801b039283169264e8d4a5100092610d6992600160681b90046001600160681b031691600160801b909104166138cc565b60038501548654610d8c916001600160681b0316906001600160801b03166138cc565b610d9691906138e3565b610da091906138f6565b610daa9190613918565b9050610db581612f3c565b600184018054601090610dd9908490600160801b90046001600160801b0316613962565b82546101009290920a6001600160801b038181021990931691831602179091558454600160801b810482169250600091610e2991610e19918b91166138cc565b86546001600160801b0316612f8c565b9050610e3481612f3c565b85546001600160801b03918216600160801b0291161785556003840154610eb39064e8d4a5100090610e77906001600160681b03600160681b90910416846138cc565b60038701548854610e9a916001600160681b0316906001600160801b03166138cc565b610ea491906138e3565b610eae91906138f6565b612f3c565b6001860180546001600160801b0319166001600160801b039283161790556002850154610ef2918491610ee8918591166138e3565b610eae9190613918565b60029490940180546001600160801b0319166001600160801b0390951694909417909355505050505b610f2481613982565b9050610cb1565b50505050565b610f3a8161256f565b50565b610f45612482565b6001600160a01b0382163b610fab5760405162461bcd60e51b815260206004820152602660248201527f6164643a204c5020746f6b656e206d75737420626520612076616c696420636f6044820152651b9d1c9858dd60d21b60648201526084016109ec565b610fb660068361301f565b15610ffb5760405162461bcd60e51b81526020600482015260156024820152741859190e88131408185b1c9958591e481859191959605a1b60448201526064016109ec565b6008604051806101000160405280846001600160a01b03168152602001836001600160a01b031681526020014264ffffffffff16815260200160006001600160801b0316815260200160006001600160801b0316815260200160006001600160681b0316815260200160006001600160681b031681526020014264ffffffffff16815250908060018154018082558091505060019003906000526020600020906004020160009091909190915060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060208201518160010160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160010160146101000a81548164ffffffffff021916908364ffffffffff16021790555060608201518160020160006101000a8154816001600160801b0302191690836001600160801b0316021790555060808201518160020160106101000a8154816001600160801b0302191690836001600160801b0316021790555060a08201518160030160006101000a8154816001600160681b0302191690836001600160681b0316021790555060c082015181600301600d6101000a8154816001600160681b0302191690836001600160681b0316021790555060e082015181600301601a6101000a81548164ffffffffff021916908364ffffffffff1602179055505050600880549050600a6000846001600160a01b03166001600160a01b031681526020019081526020016000208190555061124d82600661304490919063ffffffff16565b506008546001600160a01b0383169061126890600190613918565b6040517f1c482cb20f653d55406cc8aa89ebf482b8603c0ffebcf7e6182ff8ac1849d12d90600090a35050565b6002600154036112b75760405162461bcd60e51b81526004016109ec9061392b565b60026001819055506000600882815481106112d4576112d46137e2565b60009182526020808320858452600982526040808520338087529352909320805460049093029093018054909450611322926001600160a01b039190911691906001600160801b0316612ac8565b80546002830154611346916001600160801b03600160801b9091048116911661399b565b6002830180546001600160801b03929092166001600160801b031992831617905560008255600182810180549092169091558201546001600160a01b031680156113fa57604051636339720b60e11b81523360048201526001600160a01b0382169063c672e416906024016000604051808303816000875af11580156113d0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526113f8919081019061380e565b505b81546040516001600160801b039091168152849033907fbb757047c2b5f3974fe26b7c10f732e7bce710b0952a71082702781e62ae05959060200160405180910390a35050600180555050565b60085460005b8181101561146e5761145e8161256f565b61146781613982565b905061144d565b5050565b61147a612482565b6001600160a01b03811661148d57600080fd5b600380546001600160a01b038381166001600160a01b0319831681179093556040805191909216808252602082019390935233917fd5088813ba340c1c414c28daa5aec546d4c3c8061847176a15e45065ad61f62b910160405180910390a25050565b6114f8612482565b61096c6000613059565b61150a612482565b61096c6130a9565b6002600154036115345760405162461bcd60e51b81526004016109ec9061392b565b6002600155611541612529565b600060088481548110611556576115566137e2565b600091825260208083208784526009825260408085206001600160a01b03881686529092529220600490910290910191506115908561256f565b80546115ae9086908590610b689088906001600160801b03166138e3565b505081546115c7906001600160a01b03163330876130e6565b84836001600160a01b03167f16f3fbfd4bcc50a5cecb2e53e398a1ad77d89f63288ef540d862b264ed57eb1f8660405161160391815260200190565b60405180910390a3505060018055505050565b6005546001600160a01b031633146116705760405162461bcd60e51b815260206004820152601f60248201527f4d6173746572426964733a2063616c6c6572206973206e6f7420566f7465720060448201526064016109ec565b600082116116c05760405162461bcd60e51b815260206004820152601f60248201527f6e6f74696679526577617264416d6f756e743a207a65726f20616d6f756e740060448201526064016109ec565b6001600160a01b0383166000908152600a60205260408120546116e590600190613918565b90506000600882815481106116fc576116fc6137e2565b6000918252602090912060049091020160018101546003820154919250600160a01b900464ffffffffff908116600160d01b909204161061176857611744610eae84866138f6565b6002820180546001600160801b03928316600160801b0292169190911790556117f8565b600381015460018201546000916117989164ffffffffff600160d01b909204821691600160a01b909104166139bb565b600283015464ffffffffff9190911691506000906117c690600160801b90046001600160801b0316836138cc565b90506117d685610ea483896138e3565b6002840180546001600160801b03928316600160801b02921691909117905550505b60038101805464ffffffffff42908116600160d01b0264ffffffffff60d01b199092169190911790915561182d9084906138e3565b8160010160146101000a81548164ffffffffff021916908364ffffffffff1602179055505050505050565b6001600160a01b0381166000908152600a602052604081205461187d90600190613918565b92915050565b6008818154811061189357600080fd5b600091825260209091206004909102018054600182015460028301546003909301546001600160a01b0392831694509181169264ffffffffff600160a01b9092048216926001600160801b0380831693600160801b90930416916001600160681b0380831692600160681b810490911691600160d01b9091041688565b600080600060088481548110611928576119286137e2565b60009182526020822060049182020180546040516370a0823160e01b815230938101939093529093506001600160a01b0316906370a0823190602401602060405180830381865afa158015611981573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119a591906139d9565b60038301546001600160681b038082169650600160681b90910416935090508015806119e357506003820154600160d01b900464ffffffffff164211155b156119ef575050915091565b6003820154600183015460009164ffffffffff600160d01b909104811691611a1f91600160a01b90910416612088565b611a299190613918565b6002840154909150600090611a4e90600160801b90046001600160801b0316836138cc565b9050611a5c836103e86138cc565b600554600160a81b900461ffff16611a7964e8d4a51000846138cc565b611a8391906138cc565b611a8d91906138f6565b611a9790876138e3565b60028501549096506001600160801b031615611b22576002840154611ac7906001600160801b03166103e86139f2565b6001600160801b0316600560159054906101000a900461ffff166103e8611aee91906137c0565b61ffff16611b0164e8d4a51000846138cc565b611b0b91906138cc565b611b1591906138f6565b611b1f90866138e3565b94505b50505050915091565b600554600090611b4890600160a81b900461ffff166103e86137c0565b61ffff16905090565b600260015403611b735760405162461bcd60e51b81526004016109ec9061392b565b60026001556004546001600160a01b0316611bbc5760405162461bcd60e51b8152602060048201526009602482015268746f2077686572653f60b81b60448201526064016109ec565b611bf8828280806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250612b3092505050565b50505060005b81811015611e6d576000838383818110611c1a57611c1a6137e2565b602090810292909201356000818152600984526040808220338352909452929092208054929350916001600160801b0316159050611e5a57600060088381548110611c6757611c676137e2565b6000918252602090912060049182020180548254855460405163095ea7b360e01b81526001600160a01b03928316958101959095526001600160801b03166024850152919350169063095ea7b3906044016020604051808303816000875af1158015611cd7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cfb9190613a1d565b5060048054825460405163015f253560e71b81526001600160a01b039182169381019390935260009291169063af929a8090602401602060405180830381865afa158015611d4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d7191906139d9565b60048054855460405163481086bf60e11b81529283018490526001600160801b031660248301523360448301529192506001600160a01b03909116906390210d7e90606401600060405180830381600087803b158015611dd057600080fd5b505af1158015611de4573d6000803e3d6000fd5b505084546002850180546001600160801b03600160801b90930483169450909250600091611e149185911661399b565b82546001600160801b039182166101009390930a928302919092021990911617905550505060008281526009602090815260408083203384529091528120818155600101555b505080611e6690613982565b9050611bfe565b50506001805550565b611e7e612482565b600480546001600160a01b0319166001600160a01b0383169081179091556040519081527f92bc900c329289b9238e9a0b2e7e81d9e54e89dd939e2e0457888cfd331758869060200160405180910390a150565b611eda612482565b6001600160a01b038216611f305760405162461bcd60e51b815260206004820152601c60248201527f566f74657220616464726573732063616e6e6f74206265207a65726f0000000060448201526064016109ec565b60058054821515600160a01b81026001600160a81b031983166001600160a01b0387811691821792909217909455604080519190931680825260208201949094529182015233907fe69f0c141e47e9c00220eb7acfd9d9f4070e94a83943d1bec72108f8984f79f790606001610a6a565b60006060600260015403611fc75760405162461bcd60e51b81526004016109ec9061392b565b6002600155611fd4612529565b600060088581548110611fe957611fe96137e2565b6000918252602080832088845260098252604080852033865290925292206004909102909101915061201a8661256f565b80546120389087903390610b689089906001600160801b03166138e3565b83549195509350612054906001600160a01b03163330886130e6565b604051858152869033907f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a1590602001610bb8565b6000814210612097578161187d565b4292915050565b6120a6612482565b6001600160a01b03811661210b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016109ec565b610f3a81613059565b61211c612482565b6002546040516370a0823160e01b81523060048201526121aa9133916101009091046001600160a01b0316906370a0823190602401602060405180830381865afa15801561216e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061219291906139d9565b60025461010090046001600160a01b03169190612ac8565b6002546040516370a0823160e01b81523060048201527fbe9e33d7d1f0da682ee217a5a86acace89e901f93aa3ff5c6a501d9b5b379a279133916101009091046001600160a01b0316906370a0823190602401602060405180830381865afa15801561221a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061223e91906139d9565b604080516001600160a01b0390931683526020830191909152015b60405180910390a1565b6000606060006008858154811061227c5761227c6137e2565b600091825260208083206040805161010081018252600490940290910180546001600160a01b03908116855260018201549081169385019390935264ffffffffff600160a01b90930483169184019190915260028101546001600160801b038082166060860152600160801b909104166080840152600301546001600160681b0380821660a0850152600160681b82041660c0840152600160d01b90041660e082015291508061232b87611910565b60008981526009602090815260408083206001600160a01b038c168452825291829020825160808101845281546001600160801b038082168352600160801b91829004811694830185905260019093015480841695830186905204909116606082018190529496509294509192909164e8d4a51000906123ac9086906138cc565b84516123c29088906001600160801b03166138cc565b6123cc91906138e3565b6123d691906138f6565b6123e091906138e3565b6123ea9190613918565b60208501519096506001600160a01b03161561247757602084015160405163c031a66f60e01b81526001600160a01b0389811660048301529091169063c031a66f90602401600060405180830381865afa15801561244c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612474919081019061380e565b94505b505050509250929050565b6000546001600160a01b0316331461096c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016109ec565b6124e461311e565b6002805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b039091168152602001612259565b60025460ff161561096c5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016109ec565b600060088281548110612584576125846137e2565b9060005260206000209060040201905080600301601a9054906101000a900464ffffffffff1664ffffffffff16421115612679576000806125c484611910565b915091506125d182613167565b6003840180546cffffffffffffffffffffffffff19166001600160681b039290921691909117905561260281613167565b6003840180546001600160681b0392909216600160681b026cffffffffffffffffffffffffff60681b1990921691909117905560018301546126529064ffffffffff600160a01b90910416612088565b83600301601a6101000a81548164ffffffffff021916908364ffffffffff16021790555050505b600554600160a01b900460ff161561146e5760055481546040516363453ae160e01b81526001600160a01b0391821660048201529116906363453ae190602401600060405180830381600087803b1580156126d357600080fd5b505af11580156126e7573d6000803e3d6000fd5b505050505050565b60006060600060088681548110612708576127086137e2565b600091825260208083208984526009825260408085206001600160a01b038b16865290925292208054600490920290920192506001600160801b031615158061276457506001810154600160801b90046001600160801b031615155b15612872576001810154600383015482546001600160801b0380841693600160801b9081900482169364e8d4a51000936127b293600160681b9092046001600160681b0316929004166138cc565b600386015485546127d5916001600160681b0316906001600160801b03166138cc565b6127df91906138e3565b6127e991906138f6565b6127f391906138e3565b6127fd9190613918565b6001820180546001600160801b0316905560025490945061282d9061010090046001600160a01b03168786612ac8565b86866001600160a01b03167f71bab65ced2e5750775a0613be067df48ef06cf92a496ebf7663ae06609249548660405161286991815260200190565b60405180910390a35b61287b85612f3c565b81546001600160801b0319166001600160801b03918216178083556003546040516370a0823160e01b81526001600160a01b038a81166004830152600160801b9093049093169261293b92610eae9216906370a0823190602401602060405180830381865afa1580156128f2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061291691906139d9565b845461292b91906001600160801b03166138cc565b84546001600160801b0316612f8c565b82546001600160801b03908116600160801b92821683021780855560038601546129a99364e8d4a510009361298693600160681b9093046001600160681b03169291909104166138cc565b60038601548554610e9a916001600160681b0316906001600160801b03166138cc565b600183810180546001600160801b0319166001600160801b0393909316929092179091558301546001600160a01b03168015612a5257604051636339720b60e11b81526001600160a01b03898116600483015282169063c672e416906024016000604051808303816000875af1158015612a27573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612a4f919081019061380e565b94505b82546002850154612a94918491612a7c916001600160801b03600160801b90910481169116613962565b612a86919061399b565b6001600160801b0316612f3c565b8460020160006101000a8154816001600160801b0302191690836001600160801b0316021790555050505050935093915050565b6040516001600160a01b038316602482015260448101829052612b2b90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526131b3565b505050565b6000606080835167ffffffffffffffff811115612b4f57612b4f6137f8565b604051908082528060200260200182016040528015612b78578160200160208202803683370190505b509150835167ffffffffffffffff811115612b9557612b956137f8565b604051908082528060200260200182016040528015612bc857816020015b6060815260200190600190039081612bb35790505b50905060005b8451811015612f1857600060096000878481518110612bef57612bef6137e2565b602002602001015181526020019081526020016000206000336001600160a01b03166001600160a01b031681526020019081526020016000209050612c4c868381518110612c3f57612c3f6137e2565b602002602001015161256f565b80546001600160801b031615612f075760006008878481518110612c7257612c726137e2565b602002602001015181548110612c8a57612c8a6137e2565b600091825260208220600185015460049290920201600381015485549194506001600160801b0380841693600160801b9081900482169364e8d4a5100093612ce793600160681b9091046001600160681b031692909104166138cc565b60038601548754612d0a916001600160681b0316906001600160801b03166138cc565b612d1491906138e3565b612d1e91906138f6565b612d2891906138e3565b612d329190613918565b6001840180546001600160801b0390811690915560038401548554929350612da09264e8d4a5100092612d7d92600160681b90046001600160681b031691600160801b9004166138cc565b60038501548654610e9a916001600160681b0316906001600160801b03166138cc565b6001840180546001600160801b0319166001600160801b0392909216919091179055612dcc81886138e3565b965080868581518110612de157612de16137e2565b602002602001018181525050878481518110612dff57612dff6137e2565b6020026020010151336001600160a01b03167f71bab65ced2e5750775a0613be067df48ef06cf92a496ebf7663ae0660924954888781518110612e4457612e446137e2565b6020026020010151604051612e5b91815260200190565b60405180910390a360018201546001600160a01b03168015612f0357604051636339720b60e11b81523360048201526001600160a01b0382169063c672e416906024016000604051808303816000875af1158015612ebd573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612ee5919081019061380e565b868681518110612ef757612ef76137e2565b60200260200101819052505b5050505b50612f1181613982565b9050612bce565b50600254612f359061010090046001600160a01b03163385612ac8565b9193909250565b60006001600160801b03821115612f885760405162461bcd60e51b815260206004820152601060248201526f75696e74313238206f766572666c6f7760801b60448201526064016109ec565b5090565b600060038311156130105782821180612fa3575081155b15612faf575081612fb2565b50805b6000600282612fc181876138f6565b612fcb91906138e3565b612fd591906138f6565b90505b81811461300a57905080600281612fef81876138f6565b612ff991906138e3565b61300391906138f6565b9050612fd8565b5061187d565b821561187d5750600192915050565b6001600160a01b038116600090815260018301602052604081205415155b9392505050565b600061303d836001600160a01b038416613285565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6130b1612529565b6002805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586125113390565b6040516001600160a01b0380851660248301528316604482015260648101829052610f2b9085906323b872dd60e01b90608401612af4565b60025460ff1661096c5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016109ec565b60006001600160681b03821115612f885760405162461bcd60e51b815260206004820152601060248201526f75696e74313034206f766572666c6f7760801b60448201526064016109ec565b6000613208826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166132d49092919063ffffffff16565b805190915015612b2b57808060200190518101906132269190613a1d565b612b2b5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016109ec565b60008181526001830160205260408120546132cc5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561187d565b50600061187d565b60606132e384846000856132eb565b949350505050565b60608247101561334c5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016109ec565b6001600160a01b0385163b6133a35760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016109ec565b600080866001600160a01b031685876040516133bf9190613a5e565b60006040518083038185875af1925050503d80600081146133fc576040519150601f19603f3d011682016040523d82523d6000602084013e613401565b606091505b509150915061341182828661341c565b979650505050505050565b6060831561342b57508161303d565b82511561343b5782518084602001fd5b8160405162461bcd60e51b81526004016109ec9190613a7a565b60006020828403121561346757600080fd5b813561ffff8116811461303d57600080fd5b6001600160a01b0381168114610f3a57600080fd5b600080604083850312156134a157600080fd5b8235915060208301356134b381613479565b809150509250929050565b600081518084526020808501945080840160005b838110156134ee578151875295820195908201906001016134d2565b509495945050505050565b83815282602082015260606040820152600061351860608301846134be565b95945050505050565b6000806040838503121561353457600080fd5b50508035926020909101359150565b8281526040602082015260006132e360408301846134be565b6000806020838503121561356f57600080fd5b823567ffffffffffffffff8082111561358757600080fd5b818501915085601f83011261359b57600080fd5b8135818111156135aa57600080fd5b8660208260051b85010111156135bf57600080fd5b60209290920196919550909350505050565b838152600060206060818401526135eb60608401866134be565b8381036040850152845180825282820190600581901b830184018488016000805b8481101561365f57868403601f19018652825180518086529089019089860190845b8181101561364a5783518352928b0192918b019160010161362e565b5050968901969450509187019160010161360c565b50919b9a5050505050505050505050565b6000806040838503121561368357600080fd5b823561368e81613479565b946020939093013593505050565b6000602082840312156136ae57600080fd5b5035919050565b600080604083850312156136c857600080fd5b82356136d381613479565b915060208301356134b381613479565b6000602082840312156136f557600080fd5b813561303d81613479565b60008060006060848603121561371557600080fd5b8335925060208401359150604084013561372e81613479565b809150509250925092565b60008060006060848603121561374e57600080fd5b833561375981613479565b95602085013595506040909401359392505050565b8015158114610f3a57600080fd5b6000806040838503121561378f57600080fd5b823561379a81613479565b915060208301356134b38161376e565b634e487b7160e01b600052601160045260246000fd5b61ffff8281168282160390808211156137db576137db6137aa565b5092915050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561382157600080fd5b825167ffffffffffffffff8082111561383957600080fd5b818501915085601f83011261384d57600080fd5b81518181111561385f5761385f6137f8565b8060051b604051601f19603f83011681018181108582111715613884576138846137f8565b6040529182528482019250838101850191888311156138a257600080fd5b938501935b828510156138c0578451845293850193928501926138a7565b98975050505050505050565b808202811582820484141761187d5761187d6137aa565b8082018082111561187d5761187d6137aa565b60008261391357634e487b7160e01b600052601260045260246000fd5b500490565b8181038181111561187d5761187d6137aa565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6001600160801b038181168382160190808211156137db576137db6137aa565b600060018201613994576139946137aa565b5060010190565b6001600160801b038281168282160390808211156137db576137db6137aa565b64ffffffffff8281168282160390808211156137db576137db6137aa565b6000602082840312156139eb57600080fd5b5051919050565b6001600160801b03818116838216028082169190828114613a1557613a156137aa565b505092915050565b600060208284031215613a2f57600080fd5b815161303d8161376e565b60005b83811015613a55578181015183820152602001613a3d565b50506000910152565b60008251613a70818460208701613a3a565b9190910192915050565b6020815260008251806020840152613a99816040850160208701613a3a565b601f01601f1916919091016040019291505056fea2646970667358221220c33072a87811e723525236e4ea2037ac2f24a1b5e40cb1e953e5c314ca9173a464736f6c63430008130033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000a53e968b8d8a5be52d66e5bb35d9b6b6b5a5cd2f00000000000000000000000043949399d34f8b61a899581575b5259b36f418d00000000000000000000000002d9d2d78b2a5978f00e0df6addf954da9b3779f1000000000000000000000000000000000000000000000000000000000000012c

-----Decoded View---------------
Arg [0] : _Bids (address): 0xA53e968b8d8a5Be52d66e5BB35d9b6B6B5A5CD2F
Arg [1] : _veBids (address): 0x43949399D34f8B61a899581575b5259B36F418d0
Arg [2] : _voter (address): 0x2D9D2D78b2A5978F00E0df6AddF954DA9b3779F1
Arg [3] : _basePartition (uint16): 300

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000a53e968b8d8a5be52d66e5bb35d9b6b6b5a5cd2f
Arg [1] : 00000000000000000000000043949399d34f8b61a899581575b5259b36f418d0
Arg [2] : 0000000000000000000000002d9d2d78b2a5978f00e0df6addf954da9b3779f1
Arg [3] : 000000000000000000000000000000000000000000000000000000000000012c


Block Transaction Difficulty 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
Loading...
Loading
[ 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.