ETH Price: $2,953.52 (+0.56%)
 

Overview

ETH Balance

Scroll LogoScroll LogoScroll Logo0 ETH

ETH Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
BoostedMasterWombat

Compiler Version
v0.8.18+commit.87f61d96

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion
File 1 of 23 : BoostedMasterWombat.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.5;

import '@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol';
import '@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol';
import '@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol';
import '@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol';
import '@openzeppelin/contracts/token/ERC20/ERC20.sol';
import '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';
import '@openzeppelin/contracts/utils/Address.sol';
import '@openzeppelin/contracts/utils/math/SafeMath.sol';

import './libraries/DSMath.sol';
import './interfaces/IVeWom.sol';
import './interfaces/IVoter.sol';
import './interfaces/IBribeRewarderFactory.sol';
import './interfaces/IBoostedMasterWombat.sol';
import './interfaces/IBoostedMultiRewarder.sol';
import './interfaces/IMultiRewarder.sol';

/// @title BoostedMasterWombat
/// @notice MasterWombat is a boss. He is not afraid of any snakes. In fact, he drinks their venoms. So, veWom 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 VeWom.sol after any veWom minting/burning (veERC20Upgradeable hook).
/// Note that it's ownable and the owner wields tremendous power. The ownership
/// will be transferred to a governance smart contract once Wombat is sufficiently
/// distributed and the community can show to govern itself.
/// @dev Updates:
/// - Compatible with gauge voting
/// - Add support for BoostedMultiRewarder
contract BoostedMasterWombat is
    IBoostedMasterWombat,
    Initializable,
    OwnableUpgradeable,
    ReentrancyGuardUpgradeable,
    PausableUpgradeable
{
    using EnumerableSet for EnumerableSet.AddressSet;

    // Use `Native` for generic purpose
    string internal constant NATIVE_TOKEN_SYMBOL = 'Native';

    // 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 * veWom.balanceOf())
        // storage slot 2
        uint128 rewardDebt; // 20.18 fixed point. Reward debt. See explanation below.
        uint128 pendingWom; // 20.18 fixed point. Amount of pending wom
        //
        // We do some fancy math here. Basically, any point in time, the amount of WOMs
        // entitled to a user but is pending to be distributed is:
        //
        //   ((user.amount * pool.accWomPerShare + user.factor * pool.accWomPerFactorShare) / 1e12) -
        //        user.rewardDebt
        //
        // Whenever a user deposits or withdraws LP tokens to a pool. Here's what happens:
        //   1. The pool's `accWomPerShare`, `accWomPerFactorShare` (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.
        ////
        IMultiRewarder rewarder; // This rewarder will be deprecated, please also refer to the mapping of boostedRewarders
        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 accWomPerShare; // 19.12 fixed point. Accumulated WOM per share, times 1e12.
        uint104 accWomPerFactorShare; // 19.12 fixed point. Accumulated WOM per factor share
        uint40 lastRewardTimestamp;
    }

    uint256 public constant REWARD_DURATION = 7 days;
    uint256 public constant ACC_TOKEN_PRECISION = 1e12;
    uint256 public constant TOTAL_PARTITION = 1000;

    // Wom token
    IERC20 public wom;
    // Venom does not seem to hurt the Wombat, it only makes it stronger.
    IVeWom public veWom;
    // New Master Wombat address for future migrations
    IMasterWombatV3 newMasterWombat;
    // Address of Voter
    address public voter;
    // Base partition emissions (e.g. 300 for 30%).
    // BasePartition and boostedPartition add up to TOTAL_PARTITION (1000) for 100%
    uint16 public basePartition;
    // Set of all LP tokens that have been added as pools
    EnumerableSet.AddressSet internal lpTokens;
    /// @notice Info of each pool.
    /// @dev Note that `poolInfoV3[pid].rewarder` will be deprecated and it may co-exist with boostedRewarders[pid]
    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;
    // pid => address of boostedRewarder
    mapping(uint256 => IBoostedMultiRewarder) public override boostedRewarders;

    IBribeRewarderFactory public bribeRewarderFactory;

    event Add(uint256 indexed pid, IERC20 indexed lpToken, IBoostedMultiRewarder boostedRewarder);
    event SetNewMasterWombat(IMasterWombatV3 masterWormbat);
    event SetBribeRewarderFactory(IBribeRewarderFactory bribeRewarderFactory);
    event SetRewarder(uint256 indexed pid, IMultiRewarder rewarder);
    event SetBoostedRewarder(uint256 indexed pid, IBoostedMultiRewarder boostedRewarder);
    event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
    event DepositFor(address indexed user, uint256 indexed pid, uint256 amount);
    event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
    event 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 UpdateVeWOM(address indexed user, address oldVeWOM, address newVeWOM);
    event UpdateVoter(address indexed user, address oldVoter, address newVoter);
    event UpdateWOM(address indexed user, address oldWOM, address newWOM);
    event EmergencyWomWithdraw(address owner, uint256 balance);

    /// @dev Modifier ensuring that certain function can only be called by VeWom
    modifier onlyVeWom() {
        require(address(veWom) == msg.sender, 'MasterWombat: caller is not VeWom');
        _;
    }

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

    function initialize(IERC20 _wom, IVeWom _veWom, address _voter, uint16 _basePartition) external initializer {
        require(_basePartition <= TOTAL_PARTITION, 'base partition must be in range 0, 1000');

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

        wom = _wom;
        veWom = _veWom;
        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 setNewMasterWombat(IMasterWombatV3 _newMasterWombat) external onlyOwner {
        newMasterWombat = _newMasterWombat;
        emit SetNewMasterWombat(_newMasterWombat);
    }

    function setBribeRewarderFactory(IBribeRewarderFactory _bribeRewarderFactory) external onlyOwner {
        bribeRewarderFactory = _bribeRewarderFactory;
        emit SetBribeRewarderFactory(_bribeRewarderFactory);
    }

    /// @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 _boostedRewarder the rewarder
    function add(IERC20 _lpToken, IBoostedMultiRewarder _boostedRewarder) external onlyOwner {
        require(Address.isContract(address(_lpToken)), 'add: LP token must be a valid contract');
        require(
            Address.isContract(address(_boostedRewarder)) || address(_boostedRewarder) == address(0),
            'add: boostedRewarder must be contract or zero'
        );
        require(!lpTokens.contains(address(_lpToken)), 'add: LP already added');

        // update PoolInfoV3 with the new LP
        poolInfoV3.push(
            PoolInfoV3({
                lpToken: _lpToken,
                lastRewardTimestamp: uint40(block.timestamp),
                accWomPerShare: 0,
                rewarder: IMultiRewarder(address(0)),
                accWomPerFactorShare: 0,
                sumOfFactors: 0,
                periodFinish: uint40(block.timestamp),
                rewardRate: 0
            })
        );
        uint256 pid = poolInfoV3.length - 1;
        assetPid[address(_lpToken)] = pid + 1; // offset by +1
        boostedRewarders[pid] = _boostedRewarder;

        // add lpToken to the lpTokens enumerable set
        lpTokens.add(address(_lpToken));
        emit Add(pid, _lpToken, _boostedRewarder);
    }

    /// @notice Update the given pool's boostedRewarder
    /// @param _pid the pool id
    /// @param _boostedRewarder the boostedRewarder
    function setBoostedRewarder(uint256 _pid, IBoostedMultiRewarder _boostedRewarder) external override {
        require(msg.sender == address(bribeRewarderFactory) || msg.sender == owner(), 'not authorized');
        require(
            Address.isContract(address(_boostedRewarder)) || address(_boostedRewarder) == address(0),
            'set: boostedRewarder must be contract or zero'
        );

        boostedRewarders[_pid] = _boostedRewarder;
        emit SetBoostedRewarder(_pid, _boostedRewarder);
    }

    /// @notice Update the given pool's rewarder
    /// @param _pid the pool id
    /// @param _rewarder the rewarder
    function setRewarder(uint256 _pid, IMultiRewarder _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);
    }

    /// @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 accWomPerShare, uint256 accWomPerFactorShare) = calRewardPerUnit(_pid);
            pool.accWomPerShare = to104(accWomPerShare);
            pool.accWomPerFactorShare = to104(accWomPerFactorShare);
            pool.lastRewardTimestamp = uint40(lastTimeRewardApplicable(pool.periodFinish));

            // We can consider to skip this function to minimize gas
            // voter address can be zero during a migration. See comment in setVoter.
            if (voter != address(0)) {
                IVoter(voter).distribute(pool.lpToken);
            }
        }
    }

    /// @notice Distribute WOM over a period of 7 days
    /// @dev Refer to synthetix/StakingRewards.sol notifyRewardAmount
    /// Note: This looks safe from reentrancy.
    function notifyRewardAmount(address _lpToken, uint256 _amount) 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 / REWARD_DURATION);
        } else {
            uint256 remainingTime = pool.periodFinish - pool.lastRewardTimestamp;
            uint256 leftoverReward = remainingTime * pool.rewardRate;
            pool.rewardRate = to128((_amount + leftoverReward) / REWARD_DURATION);
        }

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

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

    /// @notice Helper function to migrate fund from multiple pools to the new MasterWombat.
    /// @notice user must initiate transaction from masterchef
    /// @dev Assume the orginal MasterWombat has stopped emisions
    /// hence we skip IVoter(voter).distribute() to save gas cost
    function migrate(uint256[] calldata _pids) external override nonReentrant {
        require(address(newMasterWombat) != (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(newMasterWombat), user.amount);
                uint256 newPid = newMasterWombat.getAssetPid(address(pool.lpToken));
                newMasterWombat.depositFor(newPid, user.amount, msg.sender);

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

    /// @notice Deposit LP tokens to MasterChef for WOM allocation on behalf of user
    /// @dev user must initiate transaction from masterchef
    /// @param _pid the pool id
    /// @param _amount amount to deposit
    /// @param _user the user being represented
    function depositFor(uint256 _pid, uint256 _amount, address _user) external override nonReentrant whenNotPaused {
        PoolInfoV3 storage pool = poolInfoV3[_pid];
        UserInfo storage user = userInfo[_pid][_user];

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

        // update rewarders before we update lpSupply and sumOfFactors
        _updateUserAmount(_pid, _user, user.amount + _amount);

        // safe transfer is not needed for Asset
        pool.lpToken.transferFrom(msg.sender, address(this), _amount);
        emit DepositFor(_user, _pid, _amount);
    }

    /// @notice Deposit LP tokens to MasterChef for WOM 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);

        // update rewarders before we update lpSupply and sumOfFactors
        (reward, additionalRewards) = _updateUserAmount(_pid, msg.sender, user.amount + _amount);

        // safe transfer is not needed for Asset
        pool.lpToken.transferFrom(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]];
                if (address(wom) != address(0)) {
                    // increase pending to send all rewards once
                    uint128 newRewardDebt = _getRewardDebt(
                        user.amount,
                        pool.accWomPerShare,
                        user.factor,
                        pool.accWomPerFactorShare
                    );
                    uint256 poolRewards = newRewardDebt + user.pendingWom - user.rewardDebt;

                    user.pendingWom = 0;

                    // update reward debt
                    user.rewardDebt = newRewardDebt;

                    // increase reward
                    reward += poolRewards;

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

                // if exist, update external rewarder
                IMultiRewarder rewarder = pool.rewarder;
                if (address(rewarder) != address(0)) {
                    additionalRewards[i] = rewarder.onReward(msg.sender, user.amount);
                }
                IBoostedMultiRewarder boostedRewarder = boostedRewarders[_pids[i]];
                if (address(boostedRewarder) != address(0)) {
                    // update rewarders before we update lpSupply and sumOfFactors
                    additionalRewards[i] = boostedRewarder.onReward(msg.sender, user.amount, user.factor);
                }
            }
        }

        // transfer all rewards
        // SafeERC20 is not needed as WOM will revert if transfer fails
        if (reward > 0) {
            wom.transfer(payable(msg.sender), reward);
        }
    }

    /// @notice Withdraw LP tokens from MasterWombat.
    /// @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);

        // update rewarders before we update lpSupply and sumOfFactors
        (reward, additionalRewards) = _updateUserAmount(_pid, msg.sender, user.amount - _amount);

        // SafeERC20 is not needed as Asset will revert if transfer fails
        pool.lpToken.transfer(msg.sender, _amount);
        emit Withdraw(msg.sender, _pid, _amount);
    }

    /// @notice Update user balance and distribute WOM 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 WOM
        if (user.amount > 0 || user.pendingWom > 0) {
            if (address(wom) != address(0)) {
                reward =
                    _getRewardDebt(user.amount, pool.accWomPerShare, user.factor, pool.accWomPerFactorShare) +
                    user.pendingWom -
                    user.rewardDebt;
                user.pendingWom = 0;

                // SafeERC20 is not needed as WOM will revert if transfer fails
                if (reward > 0) {
                    wom.transfer(payable(_user), reward);
                }
                emit Harvest(_user, _pid, reward);
            }
        }

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

        // update sumOfFactors
        uint256 oldFactor = user.factor;
        if (address(veWom) != address(0)) {
            user.factor = to128(DSMath.sqrt(user.amount * veWom.balanceOf(_user), user.amount));
        } else {
            user.factor = 0;
        }

        if (address(wom) != address(0)) {
            // update reward debt
            user.rewardDebt = _getRewardDebt(_amount, pool.accWomPerShare, user.factor, pool.accWomPerFactorShare);
        }

        // update rewarder before we update lpSupply and sumOfFactors
        // aggregate result from both rewardewrs
        IMultiRewarder rewarder = pool.rewarder;
        IBoostedMultiRewarder boostedRewarder = boostedRewarders[_pid];
        if (address(rewarder) != address(0) || address(boostedRewarder) != address(0)) {
            if (address(rewarder) == address(0)) {
                additionalRewards = boostedRewarder.onReward(_user, _amount, user.factor);
            } else if (address(boostedRewarder) == address(0)) {
                additionalRewards = rewarder.onReward(_user, _amount);
            } else {
                uint256[] memory temp1 = rewarder.onReward(_user, _amount);
                uint256[] memory temp2 = boostedRewarder.onReward(_user, _amount, user.factor);

                additionalRewards = concatArrays(temp1, temp2);
            }
        }

        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];

        // update rewarders before we update lpSupply and sumOfFactors
        IMultiRewarder rewarder = poolInfoV3[_pid].rewarder;
        if (address(rewarder) != address(0)) {
            rewarder.onReward(msg.sender, 0);
        }
        IBoostedMultiRewarder boostedRewarder = boostedRewarders[_pid];
        if (address(boostedRewarder) != address(0)) {
            boostedRewarder.onReward(msg.sender, 0, 0);
        }

        // safe transfer is not needed for Asset
        uint256 oldUserAmount = user.amount;
        pool.lpToken.transfer(address(msg.sender), oldUserAmount);

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

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

        emit EmergencyWithdraw(msg.sender, _pid, oldUserAmount);
    }

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

    /// @notice updates veWom address
    /// @param _newVeWom the new VeWom address
    function setVeWom(IVeWom _newVeWom) external onlyOwner {
        require(address(_newVeWom) != address(0));
        IVeWom oldVeWom = veWom;
        veWom = _newVeWom;
        emit UpdateVeWOM(msg.sender, address(oldVeWom), address(_newVeWom));
    }

    /// @notice updates wom address
    /// @param _newWom the new VeWom address
    function setWom(IERC20 _newWom) external onlyOwner {
        require(address(_newWom) != address(0));
        IERC20 oldWom = wom;
        wom = _newWom;
        emit UpdateWOM(msg.sender, address(oldWom), address(_newWom));
    }

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

    /// @notice updates factor after any veWom token operation (minting/burning)
    /// @param _user the user to update
    /// @param _newVeWomBalance the amount of veWOM
    /// @dev can only be called by veWom
    function updateFactor(address _user, uint256 _newVeWomBalance) external override onlyVeWom {
        // 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 = _getRewardDebt(user.amount, pool.accWomPerShare, user.factor, pool.accWomPerFactorShare) -
                user.rewardDebt;
            // increase pendingWom
            user.pendingWom += to128(pending);

            // update boosted partition factor
            uint256 oldFactor = user.factor;
            uint256 newFactor = DSMath.sqrt(user.amount * _newVeWomBalance, user.amount);
            user.factor = to128(newFactor);
            // update reward debt, take into account newFactor
            user.rewardDebt = _getRewardDebt(user.amount, pool.accWomPerShare, newFactor, pool.accWomPerFactorShare);

            // update boostedRewarder before we update sumOfFactors
            IBoostedMultiRewarder boostedRewarder = boostedRewarders[pid];
            if (address(boostedRewarder) != address(0)) {
                boostedRewarder.onUpdateFactor(_user, user.factor);
            }

            // also, update sumOfFactors
            pool.sumOfFactors = to128(pool.sumOfFactors + newFactor - oldFactor);
        }
    }

    /// @notice In case we need to manually migrate WOM funds from MasterChef
    /// Sends all remaining wom from the contract to the owner
    function emergencyWomWithdraw() external onlyOwner {
        // safe transfer is not needed for WOM
        wom.transfer(address(msg.sender), wom.balanceOf(address(this)));
        emit EmergencyWomWithdraw(address(msg.sender), wom.balanceOf(address(this)));
    }

    /**
     * Read-only functions
     */

    /// @notice Get bonus token info from the rewarder contract for a given pool, if it is a double reward farm
    /// @param _pid the pool id
    function rewarderBonusTokenInfo(
        uint256 _pid
    ) public view override returns (IERC20[] memory bonusTokenAddresses, string[] memory bonusTokenSymbols) {
        // aggregate result from both rewardewrs
        IMultiRewarder rewarder = poolInfoV3[_pid].rewarder;
        IBoostedMultiRewarder boostedRewarder = boostedRewarders[_pid];
        if (address(rewarder) != address(0) || address(boostedRewarder) != address(0)) {
            if (address(rewarder) == address(0)) {
                bonusTokenAddresses = boostedRewarder.rewardTokens();
            } else if (address(boostedRewarder) == address(0)) {
                bonusTokenAddresses = rewarder.rewardTokens();
            } else {
                IERC20[] memory temp1 = rewarder.rewardTokens();
                IERC20[] memory temp2 = boostedRewarder.rewardTokens();

                bonusTokenAddresses = concatArrays(temp1, temp2);
            }
        }

        uint256 len = bonusTokenAddresses.length;
        bonusTokenSymbols = new string[](len);
        for (uint256 i; i < len; ++i) {
            if (address(bonusTokenAddresses[i]) == address(0)) {
                bonusTokenSymbols[i] = NATIVE_TOKEN_SYMBOL;
            } else {
                bonusTokenSymbols[i] = IERC20Metadata(address(bonusTokenAddresses[i])).symbol();
            }
        }
    }

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

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

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

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

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

        accWomPerShare = pool.accWomPerShare;
        accWomPerFactorShare = pool.accWomPerFactorShare;

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

        uint256 secondsElapsed = lastTimeRewardApplicable(pool.periodFinish) - pool.lastRewardTimestamp;
        uint256 womReward = secondsElapsed * pool.rewardRate;
        accWomPerShare += (womReward * ACC_TOKEN_PRECISION * basePartition) / (lpSupply * TOTAL_PARTITION);

        if (pool.sumOfFactors != 0) {
            accWomPerFactorShare +=
                (womReward * ACC_TOKEN_PRECISION * (TOTAL_PARTITION - basePartition)) /
                (pool.sumOfFactors * TOTAL_PARTITION);
        }
    }

    /// @notice View function to see pending WOMs on frontend.
    /// @param _pid the pool id
    /// @param _user the user address
    function pendingTokens(
        uint256 _pid,
        address _user
    )
        external
        view
        override
        returns (
            uint256 pendingRewards,
            IERC20[] memory bonusTokenAddresses,
            string[] memory bonusTokenSymbols,
            uint256[] memory pendingBonusRewards
        )
    {
        // calculate accWomPerShare and accWomPerFactorShare
        (uint256 accWomPerShare, uint256 accWomPerFactorShare) = calRewardPerUnit(_pid);

        UserInfo storage user = userInfo[_pid][_user];
        pendingRewards =
            ((user.amount * accWomPerShare + user.factor * accWomPerFactorShare) / ACC_TOKEN_PRECISION) +
            user.pendingWom -
            user.rewardDebt;

        // If it's a double reward farm, return info about the bonus token
        (bonusTokenAddresses, bonusTokenSymbols) = rewarderBonusTokenInfo(_pid);

        // aggregate result from both rewardewrs
        IMultiRewarder rewarder = poolInfoV3[_pid].rewarder;
        IBoostedMultiRewarder boostedRewarder = boostedRewarders[_pid];
        if (address(rewarder) != address(0) || address(boostedRewarder) != address(0)) {
            if (address(rewarder) == address(0)) {
                pendingBonusRewards = boostedRewarder.pendingTokens(_user);
            } else if (address(boostedRewarder) == address(0)) {
                pendingBonusRewards = rewarder.pendingTokens(_user);
            } else {
                uint256[] memory temp1 = rewarder.pendingTokens(_user);
                uint256[] memory temp2 = boostedRewarder.pendingTokens(_user);

                pendingBonusRewards = concatArrays(temp1, temp2);
            }
        }
    }

    /// @notice [Deprecated] A backward compatible function to return the PoolInfo struct in MasterWombatV2
    function poolInfo(
        uint256 _pid
    )
        external
        view
        returns (
            IERC20 lpToken,
            uint96 allocPoint,
            IMultiRewarder rewarder,
            uint256 sumOfFactors,
            uint104 accWomPerShare,
            uint104 accWomPerFactorShare,
            uint40 lastRewardTimestamp
        )
    {
        PoolInfoV3 memory pool = poolInfoV3[_pid];

        return (
            pool.lpToken,
            0,
            pool.rewarder,
            pool.sumOfFactors,
            pool.accWomPerShare,
            pool.accWomPerFactorShare,
            pool.lastRewardTimestamp
        );
    }

    function getSumOfFactors(uint256 _pid) external view override returns (uint256) {
        return poolInfoV3[_pid].sumOfFactors;
    }

    function _getRewardDebt(
        uint256 amount,
        uint256 accWomPerShare,
        uint256 factor,
        uint256 accWomPerFactorShare
    ) internal pure returns (uint128) {
        return to128((amount * accWomPerShare + factor * accWomPerFactorShare) / ACC_TOKEN_PRECISION);
    }

    function concatArrays(uint256[] memory A, uint256[] memory B) internal pure returns (uint256[] memory returnArr) {
        returnArr = new uint256[](A.length + B.length);

        uint256 i;
        for (; i < A.length; i++) {
            returnArr[i] = A[i];
        }

        for (uint256 j; j < B.length; ) {
            returnArr[i++] = B[j++];
        }
    }

    function concatArrays(IERC20[] memory A, IERC20[] memory B) internal pure returns (IERC20[] memory returnArr) {
        returnArr = new IERC20[](A.length + B.length);

        uint256 i;
        for (; i < A.length; i++) {
            returnArr[i] = A[i];
        }

        for (uint256 j; j < B.length; ) {
            returnArr[i++] = B[j++];
        }
    }

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

    bool private _paused;

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

    function __Pausable_init_unchained() internal onlyInitializing {
        _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());
    }

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)

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

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

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

    uint256 private _status;

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

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

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

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

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

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

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [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://consensys.net/diligence/blog/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.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

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

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

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

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

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

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

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

    /**
     * @dev 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) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

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

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

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

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

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

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

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

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

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

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

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

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

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

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

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

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

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

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `amount`.
     */
    function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, amount);
        return true;
    }

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

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

        return true;
    }

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

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
            // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
            // decrementing then incrementing.
            _balances[to] += amount;
        }

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

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

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

        _totalSupply += amount;
        unchecked {
            // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
            _balances[account] += amount;
        }
        emit Transfer(address(0), account, amount);

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

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

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

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
            // Overflow not possible: amount <= accountBalance <= totalSupply.
            _totalSupply -= amount;
        }

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

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

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

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

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `amount`.
     *
     * Does not update the allowance amount in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Might emit an {Approval} event.
     */
    function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= amount, "ERC20: insufficient allowance");
            unchecked {
                _approve(owner, spender, currentAllowance - amount);
            }
        }
    }

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [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://consensys.net/diligence/blog/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.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

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

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

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

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

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

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

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

    /**
     * @dev 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) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

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

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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;
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.

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

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position 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) {
        bytes32[] memory store = _values(set._inner);
        bytes32[] memory result;

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

        return result;
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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

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

        /// @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 in the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

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

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

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

        return result;
    }
}

// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.5;

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

import './IMasterWombatV3.sol';
import './IBoostedMultiRewarder.sol';

/**
 * @dev Interface of BoostedMasterWombat
 */
interface IBoostedMasterWombat is IMasterWombatV3 {
    function getSumOfFactors(uint256 pid) external view returns (uint256 sum);

    function basePartition() external view returns (uint16);

    function add(IERC20 _lpToken, IBoostedMultiRewarder _boostedRewarder) external;

    function boostedRewarders(uint256 _pid) external view returns (IBoostedMultiRewarder);

    function setBoostedRewarder(uint256 _pid, IBoostedMultiRewarder _boostedRewarder) external;
}

// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.5;

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

interface IBoostedMultiRewarder {
    function lpToken() external view returns (IERC20 lpToken);

    function onReward(
        address _user,
        uint256 _newLpAmount,
        uint256 _newFactor
    ) external returns (uint256[] memory rewards);

    function addRewardToken(IERC20 _rewardToken, uint40 _startTimestamp, uint96 _tokenPerSec) external;

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

    function rewardTokens() external view returns (IERC20[] memory tokens);

    function rewardLength() external view returns (uint256);

    function onUpdateFactor(address _user, uint256 _newFactor) external;
}

// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.15;

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

interface IBribe {
    function onVote(
        address user,
        uint256 newVote,
        uint256 originalTotalVotes
    ) external returns (uint256[] memory rewards);

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

    function rewardTokens() external view returns (IERC20[] memory tokens);

    function rewardLength() external view returns (uint256);
}

// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.15;

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

interface IBribeRewarderFactory {
    function isRewardTokenWhitelisted(IERC20 _token) external view returns (bool);
}

// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.5;

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

/**
 * @dev Interface of the MasterWombatV3
 */
interface IMasterWombatV3 {
    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,
            IERC20[] memory bonusTokenAddresses,
            string[] memory bonusTokenSymbols,
            uint256[] memory pendingBonusRewards
        );

    function rewarderBonusTokenInfo(
        uint256 _pid
    ) external view returns (IERC20[] memory bonusTokenAddresses, string[] memory bonusTokenSymbols);

    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 transfered, uint256[] memory rewards, 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) external;
}

// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.5;

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

interface IMultiRewarder {
    function lpToken() external view returns (IERC20 lpToken);

    function onReward(address _user, uint256 _lpAmount) external returns (uint256[] memory rewards);

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

    function rewardTokens() external view returns (IERC20[] memory tokens);

    function rewardLength() external view returns (uint256);
}

// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.5;

/**
 * @dev Interface of the VeWom
 */
interface IVeWom {
    struct Breeding {
        uint48 unlockTime;
        uint104 womAmount;
        uint104 veWomAmount;
    }

    struct UserInfo {
        // reserve usage for future upgrades
        uint256[10] reserved;
        Breeding[] breedings;
    }

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

// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.15;

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

import './IBribe.sol';

interface IGauge {
    function notifyRewardAmount(IERC20 token, uint256 amount) external;
}

interface IVoter {
    struct GaugeWeight {
        uint128 allocPoint;
        uint128 voteWeight; // total amount of votes for an LP-token
    }

    function infos(
        IERC20 _lpToken
    )
        external
        view
        returns (
            uint104 supplyBaseIndex,
            uint104 supplyVoteIndex,
            uint40 nextEpochStartTime,
            uint128 claimable,
            bool whitelist,
            IGauge gaugeManager,
            IBribe bribe
        );

    // lpToken => weight, equals to sum of votes for a LP token
    function weights(IERC20 _lpToken) external view returns (uint128 allocPoint, uint128 voteWeight);

    // user address => lpToken => votes
    function votes(address _user, IERC20 _lpToken) external view returns (uint256);

    function setBribe(IERC20 _lpToken, IBribe _bribe) external;

    function distribute(IERC20 _lpToken) external;
}

// 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
{
  "viaIR": true,
  "optimizer": {
    "enabled": true,
    "runs": 1000
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":true,"internalType":"contract IERC20","name":"lpToken","type":"address"},{"indexed":false,"internalType":"contract IBoostedMultiRewarder","name":"boostedRewarder","type":"address"}],"name":"Add","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"DepositFor","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EmergencyWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"balance","type":"uint256"}],"name":"EmergencyWomWithdraw","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":"uint8","name":"version","type":"uint8"}],"name":"Initialized","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 IBoostedMultiRewarder","name":"boostedRewarder","type":"address"}],"name":"SetBoostedRewarder","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IBribeRewarderFactory","name":"bribeRewarderFactory","type":"address"}],"name":"SetBribeRewarderFactory","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IMasterWombatV3","name":"masterWormbat","type":"address"}],"name":"SetNewMasterWombat","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"contract IMultiRewarder","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":"oldVeWOM","type":"address"},{"indexed":false,"internalType":"address","name":"newVeWOM","type":"address"}],"name":"UpdateVeWOM","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"}],"name":"UpdateVoter","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"address","name":"oldWOM","type":"address"},{"indexed":false,"internalType":"address","name":"newWOM","type":"address"}],"name":"UpdateWOM","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":"REWARD_DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TOTAL_PARTITION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_lpToken","type":"address"},{"internalType":"contract IBoostedMultiRewarder","name":"_boostedRewarder","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":"","type":"uint256"}],"name":"boostedRewarders","outputs":[{"internalType":"contract IBoostedMultiRewarder","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bribeRewarderFactory","outputs":[{"internalType":"contract IBribeRewarderFactory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"calRewardPerUnit","outputs":[{"internalType":"uint256","name":"accWomPerShare","type":"uint256"},{"internalType":"uint256","name":"accWomPerFactorShare","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":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"emergencyWomWithdraw","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":"_pid","type":"uint256"}],"name":"getSumOfFactors","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_wom","type":"address"},{"internalType":"contract IVeWom","name":"_veWom","type":"address"},{"internalType":"address","name":"_voter","type":"address"},{"internalType":"uint16","name":"_basePartition","type":"uint16"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","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":[{"internalType":"address","name":"_lpToken","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"notifyRewardAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"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":"contract IERC20[]","name":"bonusTokenAddresses","type":"address[]"},{"internalType":"string[]","name":"bonusTokenSymbols","type":"string[]"},{"internalType":"uint256[]","name":"pendingBonusRewards","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"poolInfo","outputs":[{"internalType":"contract IERC20","name":"lpToken","type":"address"},{"internalType":"uint96","name":"allocPoint","type":"uint96"},{"internalType":"contract IMultiRewarder","name":"rewarder","type":"address"},{"internalType":"uint256","name":"sumOfFactors","type":"uint256"},{"internalType":"uint104","name":"accWomPerShare","type":"uint104"},{"internalType":"uint104","name":"accWomPerFactorShare","type":"uint104"},{"internalType":"uint40","name":"lastRewardTimestamp","type":"uint40"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolInfoV3","outputs":[{"internalType":"contract IERC20","name":"lpToken","type":"address"},{"internalType":"contract IMultiRewarder","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":"accWomPerShare","type":"uint104"},{"internalType":"uint104","name":"accWomPerFactorShare","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":"uint256","name":"_pid","type":"uint256"}],"name":"rewarderBonusTokenInfo","outputs":[{"internalType":"contract IERC20[]","name":"bonusTokenAddresses","type":"address[]"},{"internalType":"string[]","name":"bonusTokenSymbols","type":"string[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"contract IBoostedMultiRewarder","name":"_boostedRewarder","type":"address"}],"name":"setBoostedRewarder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IBribeRewarderFactory","name":"_bribeRewarderFactory","type":"address"}],"name":"setBribeRewarderFactory","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IMasterWombatV3","name":"_newMasterWombat","type":"address"}],"name":"setNewMasterWombat","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"contract IMultiRewarder","name":"_rewarder","type":"address"}],"name":"setRewarder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IVeWom","name":"_newVeWom","type":"address"}],"name":"setVeWom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newVoter","type":"address"}],"name":"setVoter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_newWom","type":"address"}],"name":"setWom","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":"_newVeWomBalance","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":"pendingWom","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"veWom","outputs":[{"internalType":"contract IVeWom","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"voter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"reward","type":"uint256"},{"internalType":"uint256[]","name":"additionalRewards","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"wom","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60808060405234610016576140ec908161001c8239f35b600080fdfe608080604052600436101561001357600080fd5b60003560e01c908163081e3eda146127c9575080631526fe27146126fa5780631983dbf51461264c5780632e112757146123e25780632f8759291461229c5780633e582ae6146122755780633f4ba83a146121d957806343de3207146120dd578063441a3e7014611f7b578063441b502c14611f5e57806346c96aac14611f375780634bc2a65714611eb85780634ed73d2814611ddc5780634f00a93e14611acf57806351eb05a614611ab357806352c28fab146117305780635312ea8e1461154c5780635ade228a1461152e5780635c975abb1461150b5780635da36238146114d7578063630b5ba1146114be578063715018a6146114635780637544d7d9146113f75780638456cb591461139d57806384cd668b146113765780638da5cb5b1461134f57806390210d7e1461123e57806393f1a40b146111ce5780639b128de61461113e578063abfef11114611119578063af929a8014611088578063b163e79314610fe4578063b25973b214610f53578063b66503cf14610cfa578063b8be44e714610cd0578063bc70fdbc14610c89578063be159bea14610c40578063c5a6222e14610c19578063ca6f309d14610be4578063d1e2ac8814610b78578063d93bf4fe14610891578063e2bbb15814610774578063eea0160414610754578063eeca156214610721578063f13e550714610581578063f2fde38b146104dc5763ffcd42631461022457600080fd5b346104d75760403660031901126104d7576004356102406127fa565b9060606102c861024f83613d60565b8460009392935260d06020526040600020926001600160a01b0380971693846000526020526102c0600164e8d4a510006102b16040600020956102ab8754916102a26001600160801b0398898516612dec565b9260801c612dec565b90612b9f565b04930154928360801c90612b9f565b911690612b92565b926102d281613926565b9290958060016102e1856128bd565b500154169260005260d260205260406000205416918015808015906104ce575b61034c575b87876103488861033a8961032c604051968796875260806020880152608087019061290d565b90858203604087015261296d565b90838203606085015261283c565b0390f35b9294509091156103c6575060009060246040518095819363c031a66f60e01b835260048301525afa9182156103ba576103489261033a91600091610397575b50915b91923880610306565b6103b491503d806000833e6103ac8183612b70565b810190612f89565b3861038b565b6040513d6000823e3d90fd5b9280610423575060009060246040518095819363c031a66f60e01b835260048301525afa9182156103ba576103489261033a91600091610408575b509161038e565b61041d91503d806000833e6103ac8183612b70565b38610401565b92906040519060008260248163c031a66f60e01b968782528560048301525afa9182156103ba576000926104ae575b506024600092936040519687938492835260048301525afa9283156103ba576103489361033a9261048b92600092610491575b50613f05565b9161038e565b6104a79192503d806000833e6103ac8183612b70565b9038610485565b600092506104c76024913d8086833e6103ac8183612b70565b9250610452565b50831515610301565b600080fd5b346104d75760203660031901126104d7576104f56127e4565b6104fd6129de565b6001600160a01b038116156105175761051590612a36565b005b608460405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b346104d75760003660031901126104d75761059a6129de565b6001600160a01b038060c95416906040516370a0823160e01b918282523060048301526020938483602481845afa80156103ba5785936000916106ef575b5060405163a9059cbb60e01b815233600482015260248101919091529290839060449082906000905af19182156103ba5784926106c2575b5060c954169160246040518094819382523060048301525afa9182156103ba57600092610672575b60408051338152602081018590527f2b58f1b72aa1f2865f8da73af0eaff3a2b5b670c59fed83005919fe6c23cf35c91819081015b0390a1005b90809250813d83116106bb575b6106898183612b70565b810103126104d7575161066d7f2b58f1b72aa1f2865f8da73af0eaff3a2b5b670c59fed83005919fe6c23cf35c610638565b503d61067f565b6106e190833d85116106e8575b6106d98183612b70565b810190612e85565b5084610610565b503d6106cf565b84819592503d831161071a575b6107068183612b70565b810103126104d757915184929060006105d8565b503d6106fc565b346104d75760203660031901126104d75760043580421060001461074c57506020425b604051908152f35b602090610744565b346104d75760003660031901126104d757602060405164e8d4a510008152f35b346104d75761078236612826565b61078a612eb6565b610792612aef565b61079b826128bd565b5090826000526001600160a01b0360209360d0855260406000203360005285526107e66107df846001600160801b0360406000206107d886612c80565b5416612b9f565b3383613350565b94546040516323b872dd60e01b815233600482015230602482015260448101869052919591949193879186916064918391600091165af19384156103ba5761034894610874575b506040519081527f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a15863392a36001606555604080519485948552840152604083019061283c565b61088a90873d89116106e8576106d98183612b70565b508661082d565b346104d75761089f36612870565b6108a7612eb6565b6001600160a01b0360cb541615610b34576108cb6108c6368385612e37565b613003565b50505060005b8181106108df576001606555005b8060051b83013560005260d06020526040600020336000526020526040600020906001600160801b0382541680610921575b5061091c9150612c49565b6108d1565b6109a460206109358460051b8801356128bd565b50926001600160a01b038454166001600160a01b0360cb541660006040518096819582947f095ea7b3000000000000000000000000000000000000000000000000000000008452600484019092916001600160801b036020916001600160a01b03604085019616845216910152565b03925af180156103ba57610b15575b506001600160a01b0360cb5416926001600160a01b03825416604051907faf929a800000000000000000000000000000000000000000000000000000000082526004820152602081602481885afa9081156103ba57600091610ae3575b506001600160801b03825416853b156104d75760646000928360405198899485937f90210d7e000000000000000000000000000000000000000000000000000000008552600485015260248401523360448401525af19081156103ba5761091c94600292610ad4575b505460801c9101906001600160801b03196001600160801b03610aa0845493828516612e9d565b1691161790558060051b84013560005260d06020526040600020336000526020526000600160408220828155015584610911565b610add90612b5c565b87610a79565b90506020813d602011610b0d575b81610afe60209383612b70565b810103126104d7575187610a10565b3d9150610af1565b610b2d9060203d6020116106e8576106d98183612b70565b50856109b3565b606460405162461bcd60e51b815260206004820152600960248201527f746f2077686572653f00000000000000000000000000000000000000000000006044820152fd5b346104d75760203660031901126104d7576004356001600160a01b0381168091036104d75760207fdb56ee0e5b70c19a6f0fb8c96d1d4c704abff70673e8f2ed0c2d3c1804951a9d91610bc96129de565b806001600160a01b031960cb54161760cb55604051908152a1005b346104d75760203660031901126104d75760043560005260d260205260206001600160a01b0360406000205416604051908152f35b346104d75760003660031901126104d75760206001600160a01b0360c95416604051908152f35b346104d75760003660031901126104d75761ffff60cc5460a01c166103e8908103908111610c7357602090604051908152f35b634e487b7160e01b600052601160045260246000fd5b346104d75760203660031901126104d757610cc2610348610cab600435613926565b60409291925193849360408552604085019061290d565b90838203602085015261296d565b346104d75760203660031901126104d7576040610cee600435613d60565b82519182526020820152f35b346104d75760403660031901126104d757610d136127e4565b6024908135906001600160a01b03908160cc54163303610ee9578215610ea5571660005260d16020526040600020546000198101908111610e9057610d57906128bd565b50600381019064ffffffffff9182815460d01c1693600183019484865460a01c1680821015600014610e23575050610de0926002610d9c62093a80610dbe9404613f88565b9101906001600160801b036001600160801b031983549260801b169116179055565b805464ffffffffff60d01b191642841660d01b64ffffffffff60d01b16179055565b62093a804201804211610e0e57825464ffffffffff60a01b1916911660a01b64ffffffffff60a01b16179055005b83634e487b7160e01b60005260116004526000fd5b03848111610e7b57610e5762093a80610e51610e76946102ab6002610de09901958a875460801c9116612dec565b04613f88565b6001600160801b036001600160801b031983549260801b169116179055565b610dbe565b86634e487b7160e01b60005260116004526000fd5b82634e487b7160e01b60005260116004526000fd5b606484601f6040519162461bcd60e51b8352602060048401528201527f6e6f74696679526577617264416d6f756e743a207a65726f20616d6f756e74006044820152fd5b60848460216040519162461bcd60e51b8352602060048401528201527f4d6173746572576f6d6261743a2063616c6c6572206973206e6f7420566f746560448201527f72000000000000000000000000000000000000000000000000000000000000006064820152fd5b346104d75760203660031901126104d757610f6c6127e4565b610f746129de565b6001600160a01b0380911680156104d75760c980546001600160a01b03198116831790915560408051939091166001600160a01b039081168452909116602083015233917f4dc232880b2749934fb6237a59caa2684e3a39ec7184ef19f6b27915f1b9f10d91819081015b0390a2005b346104d75760203660031901126104d75760043560cf548110156104d75761100e610100916128bd565b506001600160a01b0390818154169160018201549160036002820154910154916040519485528316602085015264ffffffffff809360a01c1660408501526001600160801b038116606085015260801c60808401526001600160681b0380821660a08501528160681c1660c084015260d01c1660e0820152f35b346104d75760203660031901126104d7576001600160a01b036110a96127e4565b1660005260d160205260406000205480156110d5576000198101908111610c7357602090604051908152f35b606460405162461bcd60e51b815260206004820152600b60248201527f696e76616c6964207069640000000000000000000000000000000000000000006044820152fd5b346104d75760003660031901126104d757602061ffff60cc5460a01c16604051908152f35b346104d75760203660031901126104d7576111576127e4565b61115f6129de565b6001600160a01b0380911680156104d75760ca80546001600160a01b03198116831790915560408051939091166001600160a01b039081168452909116602083015233917fa0956d8e03557278fdb89913cec4e0f21da09587edf25b3eecc0079cdb757ef59181908101610fdf565b346104d75760403660031901126104d7576111e76127fa565b60043560005260d06020526001600160a01b03604060002091166000526020526080604060002060018154910154604051916001600160801b03908181168452841c602084015281166040830152821c6060820152f35b346104d75760603660031901126104d75760043560243561125d612810565b90611266612eb6565b61126e612aef565b611277836128bd565b50918360005260209060d082526040600020936112c16001600160a01b0392838116968760005285526112ba866001600160801b0360406000206107d88c612c80565b9088613350565b5050546040516323b872dd60e01b8152336004820152306024820152604481018590529391839185916064918391600091165af19283156103ba577f16f3fbfd4bcc50a5cecb2e53e398a1ad77d89f63288ef540d862b264ed57eb1f93611332575b50604051908152a36001606555005b61134890833d85116106e8576106d98183612b70565b5085611323565b346104d75760003660031901126104d75760206001600160a01b0360335416604051908152f35b346104d75760003660031901126104d75760206001600160a01b0360d35416604051908152f35b346104d75760003660031901126104d7576113b66129de565b6113be612aef565b600160ff1960975416176097557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a1005b346104d75760203660031901126104d7576004356001600160a01b0381168091036104d75760207f3d43bc5171c0ab4451ccc037d67d5816ae4bf9a02b48b199b14139dbed368f68916114486129de565b806001600160a01b031960d354161760d355604051908152a1005b346104d75760003660031901126104d75761147c6129de565b60006001600160a01b036033546001600160a01b03198116603355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b346104d75760003660031901126104d757610515612c58565b346104d75760203660031901126104d75760206001600160801b0360026114ff6004356128bd565b50015416604051908152f35b346104d75760003660031901126104d757602060ff609754166040519015158152f35b346104d75760003660031901126104d757602060405162093a808152f35b346104d7576020806003193601126104d75760016004359161156c612eb6565b611575836128bd565b50908360005260d0815260406000203360005281526040600020611598856128bd565b506001600160a01b03948591015416806116e5575b508460005260d28252836040600020541680611694575b508054835460405163a9059cbb60e01b81523360048201526001600160801b039283166024820181905296929390929091859184916044918391600091165af180156103ba577fbb757047c2b5f3974fe26b7c10f732e7bce710b0952a71082702781e62ae059595600193600292611677575b500180549361164c835460801c828716612e9d565b166001600160801b031980951617905560008155019081541690556040519283523392a36001606555005b61168d90873d89116106e8576106d98183612b70565b5089611637565b60008091606460405180948193631963b13960e21b83523360048401528160248401528160448401525af180156103ba57156115c4576116de903d806000833e6103ac8183612b70565b50856115c4565b6000809160446040518094819363186e465160e31b83523360048401528160248401525af180156103ba57156115ad57611729903d806000833e6103ac8183612b70565b50856115ad565b346104d75760403660031901126104d7576117496127e4565b6117516127fa565b9061175a6129de565b6001600160a01b0380911691823b15611a49578116803b15801590611a41575b156119e75782600052602060ce81526040600020546119a35760405164ffffffffff4281166117a883612b3f565b8683528383016000815260408401828152606085016000815260808601906000825260a08701936000855260c08801976000895260e0810196875260cf546801000000000000000081101561198d57806001611807920160cf556128bd565b959095611977578c899251169c6001600160a01b03199d8e885416178755600187019351168d845416178355511661185b919064ffffffffff60a01b1964ffffffffff60a01b83549260a01b169116179055565b51905160801b6001600160801b0319166001600160801b0391909116176002820155600301936001600160681b03809251166001600160681b031986541617855551166118ee9084907fffffffffffff00000000000000000000000000ffffffffffffffffffffffffff79ffffffffffffffffffffffffff0000000000000000000000000083549260681b169116179055565b51825464ffffffffff60d01b1916911660d01b64ffffffffff60d01b1617905560cf5491600019830193838511610c73577fec85b1d1f037ff3a8722aaf5d4d8e7d93c7ff10c056430c18d76a9ec23aa397e938660005260d184526040600020558460005260d283528160406000209182541617905561196d85612bac565b50604051908152a3005b634e487b7160e01b600052600060045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6064906040519062461bcd60e51b82526004820152601560248201527f6164643a204c5020616c726561647920616464656400000000000000000000006044820152fd5b608460405162461bcd60e51b815260206004820152602d60248201527f6164643a20626f6f737465645265776172646572206d75737420626520636f6e60448201526c7472616374206f72207a65726f60981b6064820152fd5b50801561177a565b608460405162461bcd60e51b815260206004820152602660248201527f6164643a204c5020746f6b656e206d75737420626520612076616c696420636f60448201527f6e747261637400000000000000000000000000000000000000000000000000006064820152fd5b346104d75760203660031901126104d757610515600435612c80565b346104d75760403660031901126104d757611ae86127e4565b6001600160a01b0360ca54163303611d725760cf5460005b818110611b0957005b8060005260d060205260406000206001600160a01b0384166000526020526040600020906001600160801b0382541615611d6857611b4681612c80565b611b4f816128bd565b5091611b9364e8d4a51000610e5183546102ab6003880154916001600160681b03611b858185166001600160801b038416612dec565b9360681c169060801c612dec565b611be7611bc76001840192611bbe6001600160801b03611bb886549382851690612e9d565b16613f88565b9060801c612f6e565b82546001600160801b031660809190911b6001600160801b031916178255565b815490611c086001600160801b038316611c0360243582612dec565b614038565b92611c15611bc785613f88565b54906001600160801b03611c5464e8d4a51000610e5160038a01546102ab6001600160681b03611c49818416888b16612dec565b9260681c168a612dec565b166001600160801b03198254161790558360005260d26020526001600160a01b036040600020541680611ccf575b50506001600160801b03196001600160801b03611cbf611cba6002611cca980195611cb587549660801c91858816612b9f565b612b92565b613f88565b169116179055612c49565b611b00565b803b156104d7576040517fb024b4370000000000000000000000000000000000000000000000000000000081526001600160a01b038916600482015260809290921c60248301526000908290604490829084905af180156103ba57611cbf611cba6002611cca986001600160801b0319956001600160801b0395611d59575b509850505050611c82565b611d6290612b5c565b8c611d4e565b611cca9150612c49565b608460405162461bcd60e51b815260206004820152602160248201527f4d6173746572576f6d6261743a2063616c6c6572206973206e6f74205665576f60448201527f6d000000000000000000000000000000000000000000000000000000000000006064820152fd5b346104d757611e076108c6611df036612870565b611df8612eb6565b611e00612aef565b3691612e37565b919060019081606555604051928352611e2c602091606083860152606085019061283c565b9083820360408501528451908183528083019281808460051b8301019701936000915b848310611e5c5787890388f35b9091929394958098601f198382030184528588518180825194858152019101926000905b85818310611ea1575050508192509801930193019194939290979597611e4f565b919380919386518152019401920188929391611e80565b346104d75760203660031901126104d757611ed16127e4565b611ed96129de565b60cc80546001600160a01b039283166001600160a01b03198216811790925560408051939091168352602083019190915233917f9db5e84498cff91ecd1f5666fa2ecf069530eb27baffabaccefafc06bbd3cee39181908101610fdf565b346104d75760003660031901126104d75760206001600160a01b0360cc5416604051908152f35b346104d75760003660031901126104d75760206040516103e88152f35b346104d757611f8936612826565b611f91612eb6565b611f99612aef565b611fa2826128bd565b50908260005260209260d08452604060002033600052845260406000206001600160801b0390838282541610612099576107df848493611ff493611fed6001600160a01b0397612c80565b5416612b92565b945460405163a9059cbb60e01b815233600482015260248101869052919591949193879186916044918391600091165af19384156103ba576103489461207c575b506040519081527ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b568863392a36001606555604080519485948552840152604083019061283c565b61209290873d89116106e8576106d98183612b70565b5086612035565b6064866040519062461bcd60e51b82526004820152601c60248201527f77697468647261773a206e6f7420656e6f7567682062616c616e6365000000006044820152fd5b346104d75760403660031901126104d7576004356024356001600160a01b0381168091036104d75761210d6129de565b803b158015906121d1575b156121675760207f858b2cab7b344488967106b3c498c1f59de0a26b500923d9e4e06918909cd51191600161214c856128bd565b5001816001600160a01b0319825416179055604051908152a2005b608460405162461bcd60e51b815260206004820152602660248201527f7365743a207265776172646572206d75737420626520636f6e7472616374206f60448201527f72207a65726f00000000000000000000000000000000000000000000000000006064820152fd5b508015612118565b346104d75760003660031901126104d7576121f26129de565b60975460ff8116156122315760ff19166097557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a1005b606460405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152fd5b346104d75760003660031901126104d75760206001600160a01b0360ca5416604051908152f35b346104d75760403660031901126104d7576004356122b86127fa565b6001600160a01b03908160d35416331480156123d5575b156123915716803b15801590612389575b1561232f5760207f287a7483759b38235382ea705de3448dfe2ed81f04b8893ceaba580dbcdafe4b918360005260d282526040600020816001600160a01b0319825416179055604051908152a2005b608460405162461bcd60e51b815260206004820152602d60248201527f7365743a20626f6f737465645265776172646572206d75737420626520636f6e60448201526c7472616374206f72207a65726f60981b6064820152fd5b5080156122e0565b606460405162461bcd60e51b815260206004820152600e60248201527f6e6f7420617574686f72697a65640000000000000000000000000000000000006044820152fd5b50816033541633146122cf565b346104d75760803660031901126104d7576123fb6127e4565b6124036127fa565b9061240c612810565b60643561ffff8116928382036104d7576000549460ff8660081c16159485809661263f575b8015612628575b156125be576103e89060ff19978760018a8316176000556125ac575b5011612542577fffffffffffffffffffff000000000000000000000000000000000000000000009161249660ff60005460081c1661249181612a7e565b612a7e565b61249f33612a36565b600054966124c060ff8960081c166124b681612a7e565b6001606555612a7e565b609754166097556001600160a01b038092816001600160a01b031993168360c954161760c955169060ca54161760ca5561ffff60a01b60cc549360a01b1693169116171760cc5561250d57005b61ff0019166000557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160018152a1005b608460405162461bcd60e51b815260206004820152602760248201527f6261736520706172746974696f6e206d75737420626520696e2072616e67652060448201527f302c2031303030000000000000000000000000000000000000000000000000006064820152fd5b61ffff19166101011760005588612454565b608460405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152fd5b50303b1580156124385750600160ff881614612438565b50600160ff881610612431565b346104d75760203660031901126104d75760043561ffff8116908181036104d7576126756129de565b6103e8908183116104d757612688612c58565b7fffffffffffffffffffff0000ffffffffffffffffffffffffffffffffffffffff61ffff60a01b60cc549260a01b1691161760cc55818103908111610c735760405191825260208201527f7fd921cf733c788915a229b0ea58095c44ae2c275ed7835501e5135fe3c1ed0560403392a2005b346104d75760203660031901126104d75760e06127186004356128bd565b508160405161272681612b3f565b6001600160a01b038084541693848352600181015491821680602085015264ffffffffff809360a01c16604085015260036002830154926001600160801b0384169384606088015260801c60808701520154936001600160681b0393848616948560a08401528660681c16958660c084015260d01c1695869101526040519586526000602087015260408601526060850152608084015260a083015260c0820152f35b346104d75760003660031901126104d75760209060cf548152f35b600435906001600160a01b03821682036104d757565b602435906001600160a01b03821682036104d757565b604435906001600160a01b03821682036104d757565b60409060031901126104d7576004359060243590565b90815180825260208080930193019160005b82811061285c575050505090565b83518552938101939281019260010161284e565b9060206003198301126104d75760043567ffffffffffffffff928382116104d757806023830112156104d75781600401359384116104d75760248460051b830101116104d7576024019190565b60cf548110156128f75760cf60005260021b7facb8d954e2cfef495862221e91bd7523613cf8808827cb33edfe4904cc51bf290190600090565b634e487b7160e01b600052603260045260246000fd5b90815180825260208080930193019160005b82811061292d575050505090565b83516001600160a01b03168552938101939281019260010161291f565b60005b83811061295d5750506000910152565b818101518382015260200161294d565b908082519081815260208091019281808460051b8301019501936000915b84831061299b5750505050505090565b909192939495848080600193601f1980878303018852601f8c516129ca8151809281875287808801910161294a565b01160101980193019301919493929061298b565b6001600160a01b036033541633036129f257565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b603354906001600160a01b0380911691826001600160a01b0319821617603355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b15612a8557565b608460405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152fd5b60ff60975416612afb57565b606460405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152fd5b610100810190811067ffffffffffffffff82111761198d57604052565b67ffffffffffffffff811161198d57604052565b90601f8019910116810190811067ffffffffffffffff82111761198d57604052565b91908203918211610c7357565b91908201809211610c7357565b600081815260ce6020526040812054612c445760cd5468010000000000000000811015612c3057600181018060cd55811015612c1c5790826040927f83978b4c69c48dd978ab43fe30f077615294f938fb7f936d9eb340e51ea7db2e015560cd5492815260ce6020522055600190565b602482634e487b7160e01b81526032600452fd5b602482634e487b7160e01b81526041600452fd5b905090565b6000198114610c735760010190565b60cf5460005b818110612c69575050565b80612c76612c7b92612c80565b612c49565b612c5e565b612c89816128bd565b50906003820180549164ffffffffff90818460d01c164211612cad575b5050505050565b612ce6612cd2612d69956001600160681b03612ccb612d3195613d60565b9390613fe0565b16906001600160681b031916178555613fe0565b83547fffffffffffff00000000000000000000000000ffffffffffffffffffffffffff1660689190911b79ffffffffffffffffffffffffff0000000000000000000000000016178355565b80600185015460a01c16804210600014612de75750425b825464ffffffffff60d01b1916911660d01b64ffffffffff60d01b16179055565b6001600160a01b038060cc54169182612d84575b8080612ca6565b5416813b156104d7576000916024839260405194859384927f63453ae100000000000000000000000000000000000000000000000000000000845260048401525af180156103ba57612dd8575b8080612d7d565b612de190612b5c565b38612dd1565b612d48565b81810292918115918404141715610c7357565b8115612e09570490565b634e487b7160e01b600052601260045260246000fd5b67ffffffffffffffff811161198d5760051b60200190565b9291612e4282612e1f565b91612e506040519384612b70565b829481845260208094019160051b81019283116104d757905b828210612e765750505050565b81358152908301908301612e69565b908160209103126104d7575180151581036104d75790565b6001600160801b039182169082160391908211610c7357565b600260655414612ec7576002606555565b606460405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152fd5b90612f1582612e1f565b612f226040519182612b70565b8281528092612f33601f1991612e1f565b0190602036910137565b60005b828110612f4c57505050565b606082820152602001612f40565b80518210156128f75760209160051b010190565b9190916001600160801b0380809416911601918211610c7357565b60209081818403126104d75780519067ffffffffffffffff82116104d757019180601f840112156104d7578251612fbf81612e1f565b93612fcd6040519586612b70565b818552838086019260051b8201019283116104d7578301905b828210612ff4575050505090565b81518152908301908301612fe6565b906000916130118151612f0b565b9080519361304861302186612e1f565b9561302f6040519788612b70565b80875261303e601f1991612e1f565b0160208701612f3d565b8460005b83518110156132e45761305f8185612f5a565b5160005260d060205260406000203360005260205260406000209061308d6130878287612f5a565b51612c80565b81546001600160801b0381166130ae575b506130a99150612c49565b61304c565b6130c16130bb8388612f5a565b516128bd565b506001600160a01b0360c9541661320e575b600101546001600160a01b031680613194575b50506130f28186612f5a565b5160005260d26020526001600160a01b036040600020541691821561309e5760009260648492546040519586938492631963b13960e21b84523360048501526001600160801b038116602485015260801c60448401525af180156103ba576130a992600091613179575b50613167828a612f5a565b526131728189612f5a565b503861309e565b61318e91503d806000833e6103ac8183612b70565b3861315c565b60405163186e465160e31b81523360048201526001600160801b039290921660248301526000908290604490829084905af19081156103ba576000916131f3575b506131e0828a612f5a565b526131eb8189612f5a565b5038806130e6565b61320891503d806000833e6103ac8183612b70565b386131d5565b60018161328e866001600160801b03998a61328088826132788961326c64e8d4a51000610e5160036001600160a01b039f0154966102ab6001600160681b039161325c838b168a8316612dec565b9260809a60681c16908a1c612dec565b97015480931c87612f6e565b911690612e9d565b169a8b9216858a0155612b9f565b97613299868c612f5a565b526132a4858a612f5a565b516132af868c612f5a565b516040519081527f71bab65ced2e5750775a0613be067df48ef06cf92a496ebf7663ae066092495460203392a39150506130d3565b50929391509350836132f257565b60c95460405163a9059cbb60e01b81523360048201526024810186905290602090829060449082906000906001600160a01b03165af180156103ba576133355750565b61334d9060203d6020116106e8576106d98183612b70565b50565b9290600093606093613361826128bd565b508260005260d060205260406000206001600160a01b03851660005260205260406000209384546001600160801b03811690811580159061388c575b61376f575b50506001600160801b036133b584613f88565b16936001600160801b031993858588541617958688556001600160a01b0360ca54161515600014613768575060246001600160801b0388541660206001600160a01b0360ca5416604051938480926370a0823160e01b82526001600160a01b038a1660048301525afa9182156103ba57600092613732575b50611cba81611c036134629461344294612dec565b88546001600160801b031660809190911b6001600160801b031916178855565b6001600160a01b0360c954166136e0575b6001600160a01b036001850154169160005260d26020526001600160a01b0360406000205416918015808015906136d7575b6134e7575b50505050506134df611cba60026001600160801b03930195836134d988549760801c925460801c828916612f6e565b16612b92565b169116179055565b9091929394995060001461357a57508554604051631963b13960e21b81526001600160a01b03949094166004850152602484019190915260801c60448301526000908290606490829084905af19081156103ba57611cba60026001600160801b03936134df9360009161355f575b50985b93386134aa565b61357491503d806000833e6103ac8183612b70565b38613555565b929091806135fb575060405163186e465160e31b81526001600160a01b039190911660048201526024810191909152906000908290604490829084905af19081156103ba57611cba60026001600160801b03936134df936000916135e0575b5098613558565b6135f591503d806000833e6103ac8183612b70565b386135d9565b60405163186e465160e31b81526001600160a01b03831660048201526024810184905293919290916000908590604490829084905af19384156103ba576000946136b0575b508654604051631963b13960e21b81526001600160a01b039094166004850152602484019190915260801c60448301526000908290818381606481015b03925af180156103ba5760026136aa611cba926001600160801b03956134df956000926104915750613f05565b98613558565b61367d93919450916136cd6000933d8086833e6103ac8183612b70565b9491935091613640565b508315156134a5565b61371864e8d4a51000610e5160038701546102ab8b5460801c6001600160681b0361370d81851689612dec565b9360681c1690612dec565b6001600160801b0360018901911686825416179055613473565b91506020823d602011613760575b8161374d60209383612b70565b810103126104d757905190611cba61342d565b3d9150613740565b8755613462565b6001600160a01b0360c95416156133a2576137af92995064e8d4a51000916102ab610e5192600387015492611b856001600160681b039182861690612dec565b966001600160801b03806137d86137cf60018901549b8c60801c90612f6e565b828c1690612e9d565b169816600186015587613823575b836040518981527f71bab65ced2e5750775a0613be067df48ef06cf92a496ebf7663ae066092495460206001600160a01b03851692a338806133a2565b60c95460405163a9059cbb60e01b81526001600160a01b038381166004830152602482018b9052909160209183916044918391600091165af180156103ba5761386d575b506137e6565b6138859060203d6020116106e8576106d98183612b70565b5038613867565b50600187015460801c151561339d565b60209081818403126104d75780519067ffffffffffffffff82116104d757019180601f840112156104d75782516138d281612e1f565b936138e06040519586612b70565b818552838086019260051b8201019283116104d7578301905b828210613907575050505090565b81516001600160a01b03811681036104d75781529083019083016138f9565b606090613932816128bd565b50906001600160a01b0391826001809201541690600092835260209160d2835260409185838620541690821580801590613d57575b613b50575b5050505084519161397c83612e1f565b9361398983519586612b70565b838552601f196139a58161399c87612e1f565b01848801612f3d565b8596825b8681106139bc5750505050505050509091565b816139c7828c612f5a565b5116613a4957855186810181811067ffffffffffffffff821117613a35578752600681527f4e6174697665000000000000000000000000000000000000000000000000000086820152613a309190613a1f828b612f5a565b52613a2a818a612f5a565b50612c49565b6139a9565b602486634e487b7160e01b81526041600452fd5b8382613a55838d612f5a565b51168751918280927f95d89b4100000000000000000000000000000000000000000000000000000000825260049384915afa918215613b46578692613aa6575b505090613a3091613a1f828b612f5a565b9091503d8087833e613ab88183612b70565b81018782820312613b2b57815167ffffffffffffffff92838211613b42570190601f93818584011215613b42578251938411613b2f5750613b0189888c51968601160185612b70565b828452888383010111613b2b578291613b23918980613a30979601910161294a565b909138613a95565b8680fd5b886041602492634e487b7160e01b835252fd5b8880fd5b88513d88823e3d90fd5b8693949850600014613bb95750600492508651928380926306158c5560e51b82525afa908115613baf578391613b8d575b50935b3880808061396c565b613ba991503d8085833e613ba18183612b70565b81019061389c565b38613b81565b85513d85823e3d90fd5b9080613c055750506004918651928380926306158c5560e51b82525afa908115613baf578391613beb575b5093613b84565b613bff91503d8085833e613ba18183612b70565b38613be4565b90915086519285846004816306158c5560e51b948582525afa938415613b46579086918295613d3b575b50600489518094819382525afa908115613d31579082918691613d17575b50613c5b8451825190612b9f565b93613c6585612e1f565b94613c728a519687612b70565b808652613c81601f1991612e1f565b01368787013786935b613ce1575b508186925b613ca3575b5050505093613b84565b8151831015613cdc5787613cc0613cb985612c49565b9484612f5a565b5116613cd5613cce86612c49565b9587612f5a565b5280613c94565b613c99565b8051841015613d1257613d0c8489613cfa869785612f5a565b5116613d068289612f5a565b52612c49565b93613c8a565b613c8f565b613d2b91503d8088833e613ba18183612b70565b38613c4d565b87513d87823e3d90fd5b613d509195503d8084833e613ba18183612b70565b9338613c2f565b50821515613967565b613d6b6024916128bd565b509160206001600160a01b03845416604051938480926370a0823160e01b82523060048301525afa9182156103ba57600092613ecf575b5060038301546001600160681b0390818116918160681c1693801591828015613ebb575b613eb3576002613dfb613e099264ffffffffff8060018c015460a01c16804210600014613ead575042915b60d01c1690612b92565b970154968760801c90612dec565b9264e8d4a5100093848102948186041490151715610c735761ffff60cc5460a01c1691613e368386612dec565b916103e89485830292830486141715610c73576102ab613e5e926001600160801b0394612dff565b9616928315918215613e71575050505050565b839694959603838111610c7357613e8791612dec565b91808502948504141715610c7357613ea2926102ab91612dff565b903880808080612ca6565b91613df1565b509194505050565b5064ffffffffff8160d01c16421115613dc6565b90916020823d8211613efd575b81613ee960209383612b70565b81010312613efa5750519038613da2565b80fd5b3d9150613edc565b613f1a613f158251845190612b9f565b612f0b565b9260005b8251811015613f455780613f35613f409285612f5a565b51613d068288612f5a565b613f1e565b9150916000925b8151841015613f8257613f68613f6185612c49565b9483612f5a565b51613f7c613f7585612c49565b9487612f5a565b52613f4c565b92505050565b6001600160801b0390818111613f9c571690565b606460405162461bcd60e51b815260206004820152601060248201527f75696e74313238206f766572666c6f77000000000000000000000000000000006044820152fd5b6001600160681b0390818111613ff4571690565b606460405162461bcd60e51b815260206004820152601060248201527f75696e74313034206f766572666c6f77000000000000000000000000000000006044820152fd5b9190600060038411156140a75750828111801561409f575b156140995750815b61406b836140668184612dff565b612b9f565b600190811c915b84830361407e57505050565b90919350614090846140668184612dff565b821c9190614072565b91614058565b508015614050565b9290506140b057565b6001915056fea2646970667358221220425c218a2e83755322cc68872524afa70ba58217d90b42454dab4900ff7e610d64736f6c63430008120033

Deployed Bytecode

0x608080604052600436101561001357600080fd5b60003560e01c908163081e3eda146127c9575080631526fe27146126fa5780631983dbf51461264c5780632e112757146123e25780632f8759291461229c5780633e582ae6146122755780633f4ba83a146121d957806343de3207146120dd578063441a3e7014611f7b578063441b502c14611f5e57806346c96aac14611f375780634bc2a65714611eb85780634ed73d2814611ddc5780634f00a93e14611acf57806351eb05a614611ab357806352c28fab146117305780635312ea8e1461154c5780635ade228a1461152e5780635c975abb1461150b5780635da36238146114d7578063630b5ba1146114be578063715018a6146114635780637544d7d9146113f75780638456cb591461139d57806384cd668b146113765780638da5cb5b1461134f57806390210d7e1461123e57806393f1a40b146111ce5780639b128de61461113e578063abfef11114611119578063af929a8014611088578063b163e79314610fe4578063b25973b214610f53578063b66503cf14610cfa578063b8be44e714610cd0578063bc70fdbc14610c89578063be159bea14610c40578063c5a6222e14610c19578063ca6f309d14610be4578063d1e2ac8814610b78578063d93bf4fe14610891578063e2bbb15814610774578063eea0160414610754578063eeca156214610721578063f13e550714610581578063f2fde38b146104dc5763ffcd42631461022457600080fd5b346104d75760403660031901126104d7576004356102406127fa565b9060606102c861024f83613d60565b8460009392935260d06020526040600020926001600160a01b0380971693846000526020526102c0600164e8d4a510006102b16040600020956102ab8754916102a26001600160801b0398898516612dec565b9260801c612dec565b90612b9f565b04930154928360801c90612b9f565b911690612b92565b926102d281613926565b9290958060016102e1856128bd565b500154169260005260d260205260406000205416918015808015906104ce575b61034c575b87876103488861033a8961032c604051968796875260806020880152608087019061290d565b90858203604087015261296d565b90838203606085015261283c565b0390f35b9294509091156103c6575060009060246040518095819363c031a66f60e01b835260048301525afa9182156103ba576103489261033a91600091610397575b50915b91923880610306565b6103b491503d806000833e6103ac8183612b70565b810190612f89565b3861038b565b6040513d6000823e3d90fd5b9280610423575060009060246040518095819363c031a66f60e01b835260048301525afa9182156103ba576103489261033a91600091610408575b509161038e565b61041d91503d806000833e6103ac8183612b70565b38610401565b92906040519060008260248163c031a66f60e01b968782528560048301525afa9182156103ba576000926104ae575b506024600092936040519687938492835260048301525afa9283156103ba576103489361033a9261048b92600092610491575b50613f05565b9161038e565b6104a79192503d806000833e6103ac8183612b70565b9038610485565b600092506104c76024913d8086833e6103ac8183612b70565b9250610452565b50831515610301565b600080fd5b346104d75760203660031901126104d7576104f56127e4565b6104fd6129de565b6001600160a01b038116156105175761051590612a36565b005b608460405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b346104d75760003660031901126104d75761059a6129de565b6001600160a01b038060c95416906040516370a0823160e01b918282523060048301526020938483602481845afa80156103ba5785936000916106ef575b5060405163a9059cbb60e01b815233600482015260248101919091529290839060449082906000905af19182156103ba5784926106c2575b5060c954169160246040518094819382523060048301525afa9182156103ba57600092610672575b60408051338152602081018590527f2b58f1b72aa1f2865f8da73af0eaff3a2b5b670c59fed83005919fe6c23cf35c91819081015b0390a1005b90809250813d83116106bb575b6106898183612b70565b810103126104d7575161066d7f2b58f1b72aa1f2865f8da73af0eaff3a2b5b670c59fed83005919fe6c23cf35c610638565b503d61067f565b6106e190833d85116106e8575b6106d98183612b70565b810190612e85565b5084610610565b503d6106cf565b84819592503d831161071a575b6107068183612b70565b810103126104d757915184929060006105d8565b503d6106fc565b346104d75760203660031901126104d75760043580421060001461074c57506020425b604051908152f35b602090610744565b346104d75760003660031901126104d757602060405164e8d4a510008152f35b346104d75761078236612826565b61078a612eb6565b610792612aef565b61079b826128bd565b5090826000526001600160a01b0360209360d0855260406000203360005285526107e66107df846001600160801b0360406000206107d886612c80565b5416612b9f565b3383613350565b94546040516323b872dd60e01b815233600482015230602482015260448101869052919591949193879186916064918391600091165af19384156103ba5761034894610874575b506040519081527f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a15863392a36001606555604080519485948552840152604083019061283c565b61088a90873d89116106e8576106d98183612b70565b508661082d565b346104d75761089f36612870565b6108a7612eb6565b6001600160a01b0360cb541615610b34576108cb6108c6368385612e37565b613003565b50505060005b8181106108df576001606555005b8060051b83013560005260d06020526040600020336000526020526040600020906001600160801b0382541680610921575b5061091c9150612c49565b6108d1565b6109a460206109358460051b8801356128bd565b50926001600160a01b038454166001600160a01b0360cb541660006040518096819582947f095ea7b3000000000000000000000000000000000000000000000000000000008452600484019092916001600160801b036020916001600160a01b03604085019616845216910152565b03925af180156103ba57610b15575b506001600160a01b0360cb5416926001600160a01b03825416604051907faf929a800000000000000000000000000000000000000000000000000000000082526004820152602081602481885afa9081156103ba57600091610ae3575b506001600160801b03825416853b156104d75760646000928360405198899485937f90210d7e000000000000000000000000000000000000000000000000000000008552600485015260248401523360448401525af19081156103ba5761091c94600292610ad4575b505460801c9101906001600160801b03196001600160801b03610aa0845493828516612e9d565b1691161790558060051b84013560005260d06020526040600020336000526020526000600160408220828155015584610911565b610add90612b5c565b87610a79565b90506020813d602011610b0d575b81610afe60209383612b70565b810103126104d7575187610a10565b3d9150610af1565b610b2d9060203d6020116106e8576106d98183612b70565b50856109b3565b606460405162461bcd60e51b815260206004820152600960248201527f746f2077686572653f00000000000000000000000000000000000000000000006044820152fd5b346104d75760203660031901126104d7576004356001600160a01b0381168091036104d75760207fdb56ee0e5b70c19a6f0fb8c96d1d4c704abff70673e8f2ed0c2d3c1804951a9d91610bc96129de565b806001600160a01b031960cb54161760cb55604051908152a1005b346104d75760203660031901126104d75760043560005260d260205260206001600160a01b0360406000205416604051908152f35b346104d75760003660031901126104d75760206001600160a01b0360c95416604051908152f35b346104d75760003660031901126104d75761ffff60cc5460a01c166103e8908103908111610c7357602090604051908152f35b634e487b7160e01b600052601160045260246000fd5b346104d75760203660031901126104d757610cc2610348610cab600435613926565b60409291925193849360408552604085019061290d565b90838203602085015261296d565b346104d75760203660031901126104d7576040610cee600435613d60565b82519182526020820152f35b346104d75760403660031901126104d757610d136127e4565b6024908135906001600160a01b03908160cc54163303610ee9578215610ea5571660005260d16020526040600020546000198101908111610e9057610d57906128bd565b50600381019064ffffffffff9182815460d01c1693600183019484865460a01c1680821015600014610e23575050610de0926002610d9c62093a80610dbe9404613f88565b9101906001600160801b036001600160801b031983549260801b169116179055565b805464ffffffffff60d01b191642841660d01b64ffffffffff60d01b16179055565b62093a804201804211610e0e57825464ffffffffff60a01b1916911660a01b64ffffffffff60a01b16179055005b83634e487b7160e01b60005260116004526000fd5b03848111610e7b57610e5762093a80610e51610e76946102ab6002610de09901958a875460801c9116612dec565b04613f88565b6001600160801b036001600160801b031983549260801b169116179055565b610dbe565b86634e487b7160e01b60005260116004526000fd5b82634e487b7160e01b60005260116004526000fd5b606484601f6040519162461bcd60e51b8352602060048401528201527f6e6f74696679526577617264416d6f756e743a207a65726f20616d6f756e74006044820152fd5b60848460216040519162461bcd60e51b8352602060048401528201527f4d6173746572576f6d6261743a2063616c6c6572206973206e6f7420566f746560448201527f72000000000000000000000000000000000000000000000000000000000000006064820152fd5b346104d75760203660031901126104d757610f6c6127e4565b610f746129de565b6001600160a01b0380911680156104d75760c980546001600160a01b03198116831790915560408051939091166001600160a01b039081168452909116602083015233917f4dc232880b2749934fb6237a59caa2684e3a39ec7184ef19f6b27915f1b9f10d91819081015b0390a2005b346104d75760203660031901126104d75760043560cf548110156104d75761100e610100916128bd565b506001600160a01b0390818154169160018201549160036002820154910154916040519485528316602085015264ffffffffff809360a01c1660408501526001600160801b038116606085015260801c60808401526001600160681b0380821660a08501528160681c1660c084015260d01c1660e0820152f35b346104d75760203660031901126104d7576001600160a01b036110a96127e4565b1660005260d160205260406000205480156110d5576000198101908111610c7357602090604051908152f35b606460405162461bcd60e51b815260206004820152600b60248201527f696e76616c6964207069640000000000000000000000000000000000000000006044820152fd5b346104d75760003660031901126104d757602061ffff60cc5460a01c16604051908152f35b346104d75760203660031901126104d7576111576127e4565b61115f6129de565b6001600160a01b0380911680156104d75760ca80546001600160a01b03198116831790915560408051939091166001600160a01b039081168452909116602083015233917fa0956d8e03557278fdb89913cec4e0f21da09587edf25b3eecc0079cdb757ef59181908101610fdf565b346104d75760403660031901126104d7576111e76127fa565b60043560005260d06020526001600160a01b03604060002091166000526020526080604060002060018154910154604051916001600160801b03908181168452841c602084015281166040830152821c6060820152f35b346104d75760603660031901126104d75760043560243561125d612810565b90611266612eb6565b61126e612aef565b611277836128bd565b50918360005260209060d082526040600020936112c16001600160a01b0392838116968760005285526112ba866001600160801b0360406000206107d88c612c80565b9088613350565b5050546040516323b872dd60e01b8152336004820152306024820152604481018590529391839185916064918391600091165af19283156103ba577f16f3fbfd4bcc50a5cecb2e53e398a1ad77d89f63288ef540d862b264ed57eb1f93611332575b50604051908152a36001606555005b61134890833d85116106e8576106d98183612b70565b5085611323565b346104d75760003660031901126104d75760206001600160a01b0360335416604051908152f35b346104d75760003660031901126104d75760206001600160a01b0360d35416604051908152f35b346104d75760003660031901126104d7576113b66129de565b6113be612aef565b600160ff1960975416176097557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a1005b346104d75760203660031901126104d7576004356001600160a01b0381168091036104d75760207f3d43bc5171c0ab4451ccc037d67d5816ae4bf9a02b48b199b14139dbed368f68916114486129de565b806001600160a01b031960d354161760d355604051908152a1005b346104d75760003660031901126104d75761147c6129de565b60006001600160a01b036033546001600160a01b03198116603355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b346104d75760003660031901126104d757610515612c58565b346104d75760203660031901126104d75760206001600160801b0360026114ff6004356128bd565b50015416604051908152f35b346104d75760003660031901126104d757602060ff609754166040519015158152f35b346104d75760003660031901126104d757602060405162093a808152f35b346104d7576020806003193601126104d75760016004359161156c612eb6565b611575836128bd565b50908360005260d0815260406000203360005281526040600020611598856128bd565b506001600160a01b03948591015416806116e5575b508460005260d28252836040600020541680611694575b508054835460405163a9059cbb60e01b81523360048201526001600160801b039283166024820181905296929390929091859184916044918391600091165af180156103ba577fbb757047c2b5f3974fe26b7c10f732e7bce710b0952a71082702781e62ae059595600193600292611677575b500180549361164c835460801c828716612e9d565b166001600160801b031980951617905560008155019081541690556040519283523392a36001606555005b61168d90873d89116106e8576106d98183612b70565b5089611637565b60008091606460405180948193631963b13960e21b83523360048401528160248401528160448401525af180156103ba57156115c4576116de903d806000833e6103ac8183612b70565b50856115c4565b6000809160446040518094819363186e465160e31b83523360048401528160248401525af180156103ba57156115ad57611729903d806000833e6103ac8183612b70565b50856115ad565b346104d75760403660031901126104d7576117496127e4565b6117516127fa565b9061175a6129de565b6001600160a01b0380911691823b15611a49578116803b15801590611a41575b156119e75782600052602060ce81526040600020546119a35760405164ffffffffff4281166117a883612b3f565b8683528383016000815260408401828152606085016000815260808601906000825260a08701936000855260c08801976000895260e0810196875260cf546801000000000000000081101561198d57806001611807920160cf556128bd565b959095611977578c899251169c6001600160a01b03199d8e885416178755600187019351168d845416178355511661185b919064ffffffffff60a01b1964ffffffffff60a01b83549260a01b169116179055565b51905160801b6001600160801b0319166001600160801b0391909116176002820155600301936001600160681b03809251166001600160681b031986541617855551166118ee9084907fffffffffffff00000000000000000000000000ffffffffffffffffffffffffff79ffffffffffffffffffffffffff0000000000000000000000000083549260681b169116179055565b51825464ffffffffff60d01b1916911660d01b64ffffffffff60d01b1617905560cf5491600019830193838511610c73577fec85b1d1f037ff3a8722aaf5d4d8e7d93c7ff10c056430c18d76a9ec23aa397e938660005260d184526040600020558460005260d283528160406000209182541617905561196d85612bac565b50604051908152a3005b634e487b7160e01b600052600060045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6064906040519062461bcd60e51b82526004820152601560248201527f6164643a204c5020616c726561647920616464656400000000000000000000006044820152fd5b608460405162461bcd60e51b815260206004820152602d60248201527f6164643a20626f6f737465645265776172646572206d75737420626520636f6e60448201526c7472616374206f72207a65726f60981b6064820152fd5b50801561177a565b608460405162461bcd60e51b815260206004820152602660248201527f6164643a204c5020746f6b656e206d75737420626520612076616c696420636f60448201527f6e747261637400000000000000000000000000000000000000000000000000006064820152fd5b346104d75760203660031901126104d757610515600435612c80565b346104d75760403660031901126104d757611ae86127e4565b6001600160a01b0360ca54163303611d725760cf5460005b818110611b0957005b8060005260d060205260406000206001600160a01b0384166000526020526040600020906001600160801b0382541615611d6857611b4681612c80565b611b4f816128bd565b5091611b9364e8d4a51000610e5183546102ab6003880154916001600160681b03611b858185166001600160801b038416612dec565b9360681c169060801c612dec565b611be7611bc76001840192611bbe6001600160801b03611bb886549382851690612e9d565b16613f88565b9060801c612f6e565b82546001600160801b031660809190911b6001600160801b031916178255565b815490611c086001600160801b038316611c0360243582612dec565b614038565b92611c15611bc785613f88565b54906001600160801b03611c5464e8d4a51000610e5160038a01546102ab6001600160681b03611c49818416888b16612dec565b9260681c168a612dec565b166001600160801b03198254161790558360005260d26020526001600160a01b036040600020541680611ccf575b50506001600160801b03196001600160801b03611cbf611cba6002611cca980195611cb587549660801c91858816612b9f565b612b92565b613f88565b169116179055612c49565b611b00565b803b156104d7576040517fb024b4370000000000000000000000000000000000000000000000000000000081526001600160a01b038916600482015260809290921c60248301526000908290604490829084905af180156103ba57611cbf611cba6002611cca986001600160801b0319956001600160801b0395611d59575b509850505050611c82565b611d6290612b5c565b8c611d4e565b611cca9150612c49565b608460405162461bcd60e51b815260206004820152602160248201527f4d6173746572576f6d6261743a2063616c6c6572206973206e6f74205665576f60448201527f6d000000000000000000000000000000000000000000000000000000000000006064820152fd5b346104d757611e076108c6611df036612870565b611df8612eb6565b611e00612aef565b3691612e37565b919060019081606555604051928352611e2c602091606083860152606085019061283c565b9083820360408501528451908183528083019281808460051b8301019701936000915b848310611e5c5787890388f35b9091929394958098601f198382030184528588518180825194858152019101926000905b85818310611ea1575050508192509801930193019194939290979597611e4f565b919380919386518152019401920188929391611e80565b346104d75760203660031901126104d757611ed16127e4565b611ed96129de565b60cc80546001600160a01b039283166001600160a01b03198216811790925560408051939091168352602083019190915233917f9db5e84498cff91ecd1f5666fa2ecf069530eb27baffabaccefafc06bbd3cee39181908101610fdf565b346104d75760003660031901126104d75760206001600160a01b0360cc5416604051908152f35b346104d75760003660031901126104d75760206040516103e88152f35b346104d757611f8936612826565b611f91612eb6565b611f99612aef565b611fa2826128bd565b50908260005260209260d08452604060002033600052845260406000206001600160801b0390838282541610612099576107df848493611ff493611fed6001600160a01b0397612c80565b5416612b92565b945460405163a9059cbb60e01b815233600482015260248101869052919591949193879186916044918391600091165af19384156103ba576103489461207c575b506040519081527ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b568863392a36001606555604080519485948552840152604083019061283c565b61209290873d89116106e8576106d98183612b70565b5086612035565b6064866040519062461bcd60e51b82526004820152601c60248201527f77697468647261773a206e6f7420656e6f7567682062616c616e6365000000006044820152fd5b346104d75760403660031901126104d7576004356024356001600160a01b0381168091036104d75761210d6129de565b803b158015906121d1575b156121675760207f858b2cab7b344488967106b3c498c1f59de0a26b500923d9e4e06918909cd51191600161214c856128bd565b5001816001600160a01b0319825416179055604051908152a2005b608460405162461bcd60e51b815260206004820152602660248201527f7365743a207265776172646572206d75737420626520636f6e7472616374206f60448201527f72207a65726f00000000000000000000000000000000000000000000000000006064820152fd5b508015612118565b346104d75760003660031901126104d7576121f26129de565b60975460ff8116156122315760ff19166097557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a1005b606460405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152fd5b346104d75760003660031901126104d75760206001600160a01b0360ca5416604051908152f35b346104d75760403660031901126104d7576004356122b86127fa565b6001600160a01b03908160d35416331480156123d5575b156123915716803b15801590612389575b1561232f5760207f287a7483759b38235382ea705de3448dfe2ed81f04b8893ceaba580dbcdafe4b918360005260d282526040600020816001600160a01b0319825416179055604051908152a2005b608460405162461bcd60e51b815260206004820152602d60248201527f7365743a20626f6f737465645265776172646572206d75737420626520636f6e60448201526c7472616374206f72207a65726f60981b6064820152fd5b5080156122e0565b606460405162461bcd60e51b815260206004820152600e60248201527f6e6f7420617574686f72697a65640000000000000000000000000000000000006044820152fd5b50816033541633146122cf565b346104d75760803660031901126104d7576123fb6127e4565b6124036127fa565b9061240c612810565b60643561ffff8116928382036104d7576000549460ff8660081c16159485809661263f575b8015612628575b156125be576103e89060ff19978760018a8316176000556125ac575b5011612542577fffffffffffffffffffff000000000000000000000000000000000000000000009161249660ff60005460081c1661249181612a7e565b612a7e565b61249f33612a36565b600054966124c060ff8960081c166124b681612a7e565b6001606555612a7e565b609754166097556001600160a01b038092816001600160a01b031993168360c954161760c955169060ca54161760ca5561ffff60a01b60cc549360a01b1693169116171760cc5561250d57005b61ff0019166000557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160018152a1005b608460405162461bcd60e51b815260206004820152602760248201527f6261736520706172746974696f6e206d75737420626520696e2072616e67652060448201527f302c2031303030000000000000000000000000000000000000000000000000006064820152fd5b61ffff19166101011760005588612454565b608460405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152fd5b50303b1580156124385750600160ff881614612438565b50600160ff881610612431565b346104d75760203660031901126104d75760043561ffff8116908181036104d7576126756129de565b6103e8908183116104d757612688612c58565b7fffffffffffffffffffff0000ffffffffffffffffffffffffffffffffffffffff61ffff60a01b60cc549260a01b1691161760cc55818103908111610c735760405191825260208201527f7fd921cf733c788915a229b0ea58095c44ae2c275ed7835501e5135fe3c1ed0560403392a2005b346104d75760203660031901126104d75760e06127186004356128bd565b508160405161272681612b3f565b6001600160a01b038084541693848352600181015491821680602085015264ffffffffff809360a01c16604085015260036002830154926001600160801b0384169384606088015260801c60808701520154936001600160681b0393848616948560a08401528660681c16958660c084015260d01c1695869101526040519586526000602087015260408601526060850152608084015260a083015260c0820152f35b346104d75760003660031901126104d75760209060cf548152f35b600435906001600160a01b03821682036104d757565b602435906001600160a01b03821682036104d757565b604435906001600160a01b03821682036104d757565b60409060031901126104d7576004359060243590565b90815180825260208080930193019160005b82811061285c575050505090565b83518552938101939281019260010161284e565b9060206003198301126104d75760043567ffffffffffffffff928382116104d757806023830112156104d75781600401359384116104d75760248460051b830101116104d7576024019190565b60cf548110156128f75760cf60005260021b7facb8d954e2cfef495862221e91bd7523613cf8808827cb33edfe4904cc51bf290190600090565b634e487b7160e01b600052603260045260246000fd5b90815180825260208080930193019160005b82811061292d575050505090565b83516001600160a01b03168552938101939281019260010161291f565b60005b83811061295d5750506000910152565b818101518382015260200161294d565b908082519081815260208091019281808460051b8301019501936000915b84831061299b5750505050505090565b909192939495848080600193601f1980878303018852601f8c516129ca8151809281875287808801910161294a565b01160101980193019301919493929061298b565b6001600160a01b036033541633036129f257565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b603354906001600160a01b0380911691826001600160a01b0319821617603355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b15612a8557565b608460405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152fd5b60ff60975416612afb57565b606460405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152fd5b610100810190811067ffffffffffffffff82111761198d57604052565b67ffffffffffffffff811161198d57604052565b90601f8019910116810190811067ffffffffffffffff82111761198d57604052565b91908203918211610c7357565b91908201809211610c7357565b600081815260ce6020526040812054612c445760cd5468010000000000000000811015612c3057600181018060cd55811015612c1c5790826040927f83978b4c69c48dd978ab43fe30f077615294f938fb7f936d9eb340e51ea7db2e015560cd5492815260ce6020522055600190565b602482634e487b7160e01b81526032600452fd5b602482634e487b7160e01b81526041600452fd5b905090565b6000198114610c735760010190565b60cf5460005b818110612c69575050565b80612c76612c7b92612c80565b612c49565b612c5e565b612c89816128bd565b50906003820180549164ffffffffff90818460d01c164211612cad575b5050505050565b612ce6612cd2612d69956001600160681b03612ccb612d3195613d60565b9390613fe0565b16906001600160681b031916178555613fe0565b83547fffffffffffff00000000000000000000000000ffffffffffffffffffffffffff1660689190911b79ffffffffffffffffffffffffff0000000000000000000000000016178355565b80600185015460a01c16804210600014612de75750425b825464ffffffffff60d01b1916911660d01b64ffffffffff60d01b16179055565b6001600160a01b038060cc54169182612d84575b8080612ca6565b5416813b156104d7576000916024839260405194859384927f63453ae100000000000000000000000000000000000000000000000000000000845260048401525af180156103ba57612dd8575b8080612d7d565b612de190612b5c565b38612dd1565b612d48565b81810292918115918404141715610c7357565b8115612e09570490565b634e487b7160e01b600052601260045260246000fd5b67ffffffffffffffff811161198d5760051b60200190565b9291612e4282612e1f565b91612e506040519384612b70565b829481845260208094019160051b81019283116104d757905b828210612e765750505050565b81358152908301908301612e69565b908160209103126104d7575180151581036104d75790565b6001600160801b039182169082160391908211610c7357565b600260655414612ec7576002606555565b606460405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152fd5b90612f1582612e1f565b612f226040519182612b70565b8281528092612f33601f1991612e1f565b0190602036910137565b60005b828110612f4c57505050565b606082820152602001612f40565b80518210156128f75760209160051b010190565b9190916001600160801b0380809416911601918211610c7357565b60209081818403126104d75780519067ffffffffffffffff82116104d757019180601f840112156104d7578251612fbf81612e1f565b93612fcd6040519586612b70565b818552838086019260051b8201019283116104d7578301905b828210612ff4575050505090565b81518152908301908301612fe6565b906000916130118151612f0b565b9080519361304861302186612e1f565b9561302f6040519788612b70565b80875261303e601f1991612e1f565b0160208701612f3d565b8460005b83518110156132e45761305f8185612f5a565b5160005260d060205260406000203360005260205260406000209061308d6130878287612f5a565b51612c80565b81546001600160801b0381166130ae575b506130a99150612c49565b61304c565b6130c16130bb8388612f5a565b516128bd565b506001600160a01b0360c9541661320e575b600101546001600160a01b031680613194575b50506130f28186612f5a565b5160005260d26020526001600160a01b036040600020541691821561309e5760009260648492546040519586938492631963b13960e21b84523360048501526001600160801b038116602485015260801c60448401525af180156103ba576130a992600091613179575b50613167828a612f5a565b526131728189612f5a565b503861309e565b61318e91503d806000833e6103ac8183612b70565b3861315c565b60405163186e465160e31b81523360048201526001600160801b039290921660248301526000908290604490829084905af19081156103ba576000916131f3575b506131e0828a612f5a565b526131eb8189612f5a565b5038806130e6565b61320891503d806000833e6103ac8183612b70565b386131d5565b60018161328e866001600160801b03998a61328088826132788961326c64e8d4a51000610e5160036001600160a01b039f0154966102ab6001600160681b039161325c838b168a8316612dec565b9260809a60681c16908a1c612dec565b97015480931c87612f6e565b911690612e9d565b169a8b9216858a0155612b9f565b97613299868c612f5a565b526132a4858a612f5a565b516132af868c612f5a565b516040519081527f71bab65ced2e5750775a0613be067df48ef06cf92a496ebf7663ae066092495460203392a39150506130d3565b50929391509350836132f257565b60c95460405163a9059cbb60e01b81523360048201526024810186905290602090829060449082906000906001600160a01b03165af180156103ba576133355750565b61334d9060203d6020116106e8576106d98183612b70565b50565b9290600093606093613361826128bd565b508260005260d060205260406000206001600160a01b03851660005260205260406000209384546001600160801b03811690811580159061388c575b61376f575b50506001600160801b036133b584613f88565b16936001600160801b031993858588541617958688556001600160a01b0360ca54161515600014613768575060246001600160801b0388541660206001600160a01b0360ca5416604051938480926370a0823160e01b82526001600160a01b038a1660048301525afa9182156103ba57600092613732575b50611cba81611c036134629461344294612dec565b88546001600160801b031660809190911b6001600160801b031916178855565b6001600160a01b0360c954166136e0575b6001600160a01b036001850154169160005260d26020526001600160a01b0360406000205416918015808015906136d7575b6134e7575b50505050506134df611cba60026001600160801b03930195836134d988549760801c925460801c828916612f6e565b16612b92565b169116179055565b9091929394995060001461357a57508554604051631963b13960e21b81526001600160a01b03949094166004850152602484019190915260801c60448301526000908290606490829084905af19081156103ba57611cba60026001600160801b03936134df9360009161355f575b50985b93386134aa565b61357491503d806000833e6103ac8183612b70565b38613555565b929091806135fb575060405163186e465160e31b81526001600160a01b039190911660048201526024810191909152906000908290604490829084905af19081156103ba57611cba60026001600160801b03936134df936000916135e0575b5098613558565b6135f591503d806000833e6103ac8183612b70565b386135d9565b60405163186e465160e31b81526001600160a01b03831660048201526024810184905293919290916000908590604490829084905af19384156103ba576000946136b0575b508654604051631963b13960e21b81526001600160a01b039094166004850152602484019190915260801c60448301526000908290818381606481015b03925af180156103ba5760026136aa611cba926001600160801b03956134df956000926104915750613f05565b98613558565b61367d93919450916136cd6000933d8086833e6103ac8183612b70565b9491935091613640565b508315156134a5565b61371864e8d4a51000610e5160038701546102ab8b5460801c6001600160681b0361370d81851689612dec565b9360681c1690612dec565b6001600160801b0360018901911686825416179055613473565b91506020823d602011613760575b8161374d60209383612b70565b810103126104d757905190611cba61342d565b3d9150613740565b8755613462565b6001600160a01b0360c95416156133a2576137af92995064e8d4a51000916102ab610e5192600387015492611b856001600160681b039182861690612dec565b966001600160801b03806137d86137cf60018901549b8c60801c90612f6e565b828c1690612e9d565b169816600186015587613823575b836040518981527f71bab65ced2e5750775a0613be067df48ef06cf92a496ebf7663ae066092495460206001600160a01b03851692a338806133a2565b60c95460405163a9059cbb60e01b81526001600160a01b038381166004830152602482018b9052909160209183916044918391600091165af180156103ba5761386d575b506137e6565b6138859060203d6020116106e8576106d98183612b70565b5038613867565b50600187015460801c151561339d565b60209081818403126104d75780519067ffffffffffffffff82116104d757019180601f840112156104d75782516138d281612e1f565b936138e06040519586612b70565b818552838086019260051b8201019283116104d7578301905b828210613907575050505090565b81516001600160a01b03811681036104d75781529083019083016138f9565b606090613932816128bd565b50906001600160a01b0391826001809201541690600092835260209160d2835260409185838620541690821580801590613d57575b613b50575b5050505084519161397c83612e1f565b9361398983519586612b70565b838552601f196139a58161399c87612e1f565b01848801612f3d565b8596825b8681106139bc5750505050505050509091565b816139c7828c612f5a565b5116613a4957855186810181811067ffffffffffffffff821117613a35578752600681527f4e6174697665000000000000000000000000000000000000000000000000000086820152613a309190613a1f828b612f5a565b52613a2a818a612f5a565b50612c49565b6139a9565b602486634e487b7160e01b81526041600452fd5b8382613a55838d612f5a565b51168751918280927f95d89b4100000000000000000000000000000000000000000000000000000000825260049384915afa918215613b46578692613aa6575b505090613a3091613a1f828b612f5a565b9091503d8087833e613ab88183612b70565b81018782820312613b2b57815167ffffffffffffffff92838211613b42570190601f93818584011215613b42578251938411613b2f5750613b0189888c51968601160185612b70565b828452888383010111613b2b578291613b23918980613a30979601910161294a565b909138613a95565b8680fd5b886041602492634e487b7160e01b835252fd5b8880fd5b88513d88823e3d90fd5b8693949850600014613bb95750600492508651928380926306158c5560e51b82525afa908115613baf578391613b8d575b50935b3880808061396c565b613ba991503d8085833e613ba18183612b70565b81019061389c565b38613b81565b85513d85823e3d90fd5b9080613c055750506004918651928380926306158c5560e51b82525afa908115613baf578391613beb575b5093613b84565b613bff91503d8085833e613ba18183612b70565b38613be4565b90915086519285846004816306158c5560e51b948582525afa938415613b46579086918295613d3b575b50600489518094819382525afa908115613d31579082918691613d17575b50613c5b8451825190612b9f565b93613c6585612e1f565b94613c728a519687612b70565b808652613c81601f1991612e1f565b01368787013786935b613ce1575b508186925b613ca3575b5050505093613b84565b8151831015613cdc5787613cc0613cb985612c49565b9484612f5a565b5116613cd5613cce86612c49565b9587612f5a565b5280613c94565b613c99565b8051841015613d1257613d0c8489613cfa869785612f5a565b5116613d068289612f5a565b52612c49565b93613c8a565b613c8f565b613d2b91503d8088833e613ba18183612b70565b38613c4d565b87513d87823e3d90fd5b613d509195503d8084833e613ba18183612b70565b9338613c2f565b50821515613967565b613d6b6024916128bd565b509160206001600160a01b03845416604051938480926370a0823160e01b82523060048301525afa9182156103ba57600092613ecf575b5060038301546001600160681b0390818116918160681c1693801591828015613ebb575b613eb3576002613dfb613e099264ffffffffff8060018c015460a01c16804210600014613ead575042915b60d01c1690612b92565b970154968760801c90612dec565b9264e8d4a5100093848102948186041490151715610c735761ffff60cc5460a01c1691613e368386612dec565b916103e89485830292830486141715610c73576102ab613e5e926001600160801b0394612dff565b9616928315918215613e71575050505050565b839694959603838111610c7357613e8791612dec565b91808502948504141715610c7357613ea2926102ab91612dff565b903880808080612ca6565b91613df1565b509194505050565b5064ffffffffff8160d01c16421115613dc6565b90916020823d8211613efd575b81613ee960209383612b70565b81010312613efa5750519038613da2565b80fd5b3d9150613edc565b613f1a613f158251845190612b9f565b612f0b565b9260005b8251811015613f455780613f35613f409285612f5a565b51613d068288612f5a565b613f1e565b9150916000925b8151841015613f8257613f68613f6185612c49565b9483612f5a565b51613f7c613f7585612c49565b9487612f5a565b52613f4c565b92505050565b6001600160801b0390818111613f9c571690565b606460405162461bcd60e51b815260206004820152601060248201527f75696e74313238206f766572666c6f77000000000000000000000000000000006044820152fd5b6001600160681b0390818111613ff4571690565b606460405162461bcd60e51b815260206004820152601060248201527f75696e74313034206f766572666c6f77000000000000000000000000000000006044820152fd5b9190600060038411156140a75750828111801561409f575b156140995750815b61406b836140668184612dff565b612b9f565b600190811c915b84830361407e57505050565b90919350614090846140668184612dff565b821c9190614072565b91614058565b508015614050565b9290506140b057565b6001915056fea2646970667358221220425c218a2e83755322cc68872524afa70ba58217d90b42454dab4900ff7e610d64736f6c63430008120033

Block Transaction Gas Used Reward
view all blocks sequenced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

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.