FTM Price: $0.99 (-3.66%)
Gas: 36 GWei

Contract

0x430607e5B2d72898d822bF132296aBbdb3313574
 

Overview

FTM Balance

Fantom LogoFantom LogoFantom Logo0 FTM

FTM Value

$0.00

Token Holdings

Sponsored

Transaction Hash
Method
Block
From
To
Value
Transfer Ownersh...371300362022-04-28 8:24:04701 days ago1651134244IN
0x430607e5...db3313574
0 FTM0.01388279438.9261
Add371298282022-04-28 8:18:36701 days ago1651133916IN
0x430607e5...db3313574
0 FTM0.05359757400.2268
Set Reward Per S...371297872022-04-28 8:17:54701 days ago1651133874IN
0x430607e5...db3313574
0 FTM0.01784548390.8683
Initialize Rewar...371296952022-04-28 8:16:23701 days ago1651133783IN
0x430607e5...db3313574
0 FTM0.03123712394.5426
0x60a06040371294932022-04-28 8:13:03701 days ago1651133583IN
 Create: TimeBasedMasterChefRewarder
0 FTM0.69641713422.8326

Latest 1 internal transaction

Parent Txn Hash Block From To Value
371294932022-04-28 8:13:03701 days ago1651133583  Contract Creation0 FTM
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
TimeBasedMasterChefRewarder

Compiler Version
v0.8.7+commit.e28d00a7

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 12 : TimeBasedMasterChefRewarder.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.7;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../interfaces/IRewarder.sol";
import "../token/BeethovenxMasterChef.sol";

contract TimeBasedMasterChefRewarder is IRewarder, Ownable {
    using SafeERC20 for ERC20;

    ERC20 public rewardToken;

    struct UserInfo {
        uint256 amount;
        uint256 rewardDebt;
    }

    struct PoolInfo {
        uint256 accRewardTokenPerShare;
        uint256 lastRewardTime;
        uint256 allocPoint;
    }

    /// @notice Info of each pool.
    mapping(uint256 => PoolInfo) public poolInfo;

    uint256[] public masterchefPoolIds;

    /// @notice Info of each user that stakes LP tokens.
    mapping(uint256 => mapping(address => UserInfo)) public userInfo;
    /// @dev Total allocation points. Must be the sum of all allocation points in all pools.
    uint256 totalAllocPoint;

    uint256 public rewardPerSecond = 0;

    uint256 public accTokenPrecision;

    address public immutable masterChef;

    event LogOnReward(
        address indexed user,
        uint256 indexed pid,
        uint256 amount,
        address indexed to
    );
    event LogPoolAddition(uint256 indexed pid, uint256 allocPoint);
    event LogSetPool(uint256 indexed pid, uint256 allocPoint);
    event LogUpdatePool(
        uint256 indexed pid,
        uint256 lastRewardTime,
        uint256 lpSupply,
        uint256 accRewardTokenPerShare
    );
    event LogRewardPerSecond(uint256 rewardPerSecond);
    event LogSetRewardToken(
        IERC20 indexed rewardToken,
        uint256 accTokenPrecision
    );
    event LogInit();

    constructor(address _masterChef) {
        masterChef = _masterChef;
    }

    /// @notice To allow contract verification on matching similar source, we dont provide this in the constructor
    function initializeRewardToken(ERC20 token) external onlyOwner {
        require(
            address(rewardToken) == address(0),
            "Reward token can only be set once"
        );
        uint8 decimals = token.decimals();
        require(decimals <= 18, "maximum 18 decimals supported");
        /* 
            since bpts have 18 decimals, and we want additional 12 decimals precision, we need to set the 
            accTokenPrecision relative based on reward token decimals
        */
        accTokenPrecision = 10**uint256(18 - decimals + 12);
        rewardToken = token;
        emit LogSetRewardToken(token, accTokenPrecision);
    }

    function onBeetsReward(
        uint256 pid,
        address userAddress,
        address recipient,
        uint256,
        uint256 newLpAmount
    ) external override onlyMasterChef {
        PoolInfo memory pool = updatePool(pid);
        UserInfo storage userPoolInfo = userInfo[pid][userAddress];
        uint256 pending;
        if (userPoolInfo.amount > 0) {
            pending =
                ((userPoolInfo.amount * pool.accRewardTokenPerShare) /
                    accTokenPrecision) -
                userPoolInfo.rewardDebt;
            if (pending > rewardToken.balanceOf(address(this))) {
                pending = rewardToken.balanceOf(address(this));
            }
        }
        userPoolInfo.amount = newLpAmount;
        userPoolInfo.rewardDebt =
            (newLpAmount * pool.accRewardTokenPerShare) /
            accTokenPrecision;

        if (pending > 0) {
            rewardToken.safeTransfer(recipient, pending);
        }

        emit LogOnReward(userAddress, pid, pending, recipient);
    }

    function pendingTokens(
        uint256 pid,
        address user,
        uint256
    )
        external
        view
        override
        returns (IERC20[] memory rewardTokens, uint256[] memory rewardAmounts)
    {
        IERC20[] memory _rewardTokens = new IERC20[](1);
        _rewardTokens[0] = (rewardToken);
        uint256[] memory _rewardAmounts = new uint256[](1);
        _rewardAmounts[0] = pendingToken(pid, user);
        return (_rewardTokens, _rewardAmounts);
    }

    /// @notice Sets the rewards per second to be distributed. Can only be called by the owner.
    /// @param _rewardPerSecond The amount of token rewards to be distributed per second.
    function setRewardPerSecond(uint256 _rewardPerSecond) public onlyOwner {
        rewardPerSecond = _rewardPerSecond;
        emit LogRewardPerSecond(_rewardPerSecond);
    }

    modifier onlyMasterChef() {
        require(
            msg.sender == masterChef,
            "Only MasterChef can call this function."
        );
        _;
    }

    /// @notice Returns the number of rewarded pools.
    function poolLength() public view returns (uint256 pools) {
        pools = masterchefPoolIds.length;
    }

    /// @notice Add a new LP to the pool. Can only be called by the owner.
    /// @param allocPoint AP of the new pool.
    /// @param pid Pid on MasterChef
    function add(uint256 pid, uint256 allocPoint) public onlyOwner {
        require(poolInfo[pid].lastRewardTime == 0, "Pool already exists");
        uint256 lastRewardTime = block.timestamp;
        totalAllocPoint = totalAllocPoint + allocPoint;

        poolInfo[pid] = PoolInfo({
            allocPoint: allocPoint,
            lastRewardTime: lastRewardTime,
            accRewardTokenPerShare: 0
        });
        masterchefPoolIds.push(pid);
        emit LogPoolAddition(pid, allocPoint);
    }

    /// @notice Update the given pool's reward token allocation point and `IRewarder` contract. Can only be called by the owner.
    /// @param pid The index of the MasterChef pool. See `poolInfo`.
    /// @param allocPoint New AP of the pool.
    function set(uint256 pid, uint256 allocPoint) public onlyOwner {
        require(poolInfo[pid].lastRewardTime != 0, "Pool does not exist");
        totalAllocPoint =
            totalAllocPoint -
            poolInfo[pid].allocPoint +
            allocPoint;

        poolInfo[pid].allocPoint = allocPoint;
        emit LogSetPool(pid, allocPoint);
    }

    /// @notice View function to see pending Token
    /// @param _pid The index of the MasterChef pool. See `poolInfo`.
    /// @param _user Address of user.
    /// @return pending rewards for a given user.
    function pendingToken(uint256 _pid, address _user)
        public
        view
        returns (uint256 pending)
    {
        PoolInfo memory pool = poolInfo[_pid];
        if (pool.lastRewardTime == 0) {
            pending = 0;
        } else {
            UserInfo storage user = userInfo[_pid][_user];
            uint256 accRewardTokenPerShare = pool.accRewardTokenPerShare;

            uint256 totalLpSupply = BeethovenxMasterChef(masterChef)
                .lpTokens(_pid)
                .balanceOf(masterChef);

            if (block.timestamp > pool.lastRewardTime && totalLpSupply != 0) {
                uint256 timeSinceLastReward = block.timestamp -
                    pool.lastRewardTime;

                uint256 rewards = (timeSinceLastReward *
                    rewardPerSecond *
                    pool.allocPoint) / totalAllocPoint;

                accRewardTokenPerShare =
                    accRewardTokenPerShare +
                    ((rewards * accTokenPrecision) / totalLpSupply);
            }
            pending =
                ((user.amount * accRewardTokenPerShare) / accTokenPrecision) -
                user.rewardDebt;
            if (pending > rewardToken.balanceOf(address(this))) {
                pending = rewardToken.balanceOf(address(this));
            }
        }
    }

    /// @notice Update reward variables for all pools. Be careful of gas spending!
    /// @param pids Pool IDs of all to be updated. Make sure to update all active pools.
    function massUpdatePools(uint256[] calldata pids) external {
        uint256 len = pids.length;
        for (uint256 i = 0; i < len; ++i) {
            updatePool(pids[i]);
        }
    }

    /// @notice Update reward variables of the given pool.
    /// @param pid The index of the pool. See `poolInfo`.
    /// @return pool Returns the pool that was updated.
    function updatePool(uint256 pid) public returns (PoolInfo memory pool) {
        pool = poolInfo[pid];
        if (pool.lastRewardTime != 0 && block.timestamp > pool.lastRewardTime) {
            uint256 totalLpSupply = BeethovenxMasterChef(masterChef)
                .lpTokens(pid)
                .balanceOf(masterChef);

            if (totalLpSupply > 0) {
                uint256 time = block.timestamp - pool.lastRewardTime;
                uint256 tokenReward = (time *
                    rewardPerSecond *
                    pool.allocPoint) / totalAllocPoint;
                pool.accRewardTokenPerShare =
                    pool.accRewardTokenPerShare +
                    ((tokenReward * accTokenPrecision) / totalLpSupply);
            }
            pool.lastRewardTime = block.timestamp;
            poolInfo[pid] = pool;
            emit LogUpdatePool(
                pid,
                pool.lastRewardTime,
                totalLpSupply,
                pool.accRewardTokenPerShare
            );
        }
    }

    /// @notice Top up reward token as a safer alternative to transfer
    /// @param amount Amount of rewards to add
    function topUpRewards(uint256 amount) external {
        rewardToken.safeTransferFrom(msg.sender, address(this), amount);
    }

    /// @notice sets rewards per second to 0 and withdraws remaining funds
    /// @param withdrawRemainingFundsTo where to withdraaw the remaining funds to
    function shutDown(address withdrawRemainingFundsTo) external onlyOwner {
        setRewardPerSecond(0);
        rewardToken.transfer(
            withdrawRemainingFundsTo,
            rewardToken.balanceOf(address(this))
        );
    }
}

File 2 of 12 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

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

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

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

File 3 of 12 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../../../utils/Address.sol";

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

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

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

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

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

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

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

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

File 4 of 12 : IRewarder.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.7;

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

interface IRewarder {
    function onBeetsReward(
        uint256 pid,
        address user,
        address recipient,
        uint256 beetsAmount,
        uint256 newLpAmount
    ) external;

    function pendingTokens(
        uint256 pid,
        address user,
        uint256 beetsAmount
    ) external view returns (IERC20[] memory, uint256[] memory);
}

File 5 of 12 : BeethovenxMasterChef.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.7;

import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "./BeethovenxToken.sol";
import "../interfaces/IRewarder.sol";

/*
    This master chef is based on SUSHI's version with some adjustments:
     - Upgrade to pragma 0.8.7
     - therefore remove usage of SafeMath (built in overflow check for solidity > 8)
     - Merge sushi's master chef V1 & V2 (no usage of dummy pool)
     - remove withdraw function (without harvest) => requires the rewardDebt to be an signed int instead of uint which requires a lot of casting and has no real usecase for us
     - no dev emissions, but treasury emissions instead
     - treasury percentage is subtracted from emissions instead of added on top
     - update of emission rate with upper limit of 6 BEETS/block
     - more require checks in general
*/

// Have fun reading it. Hopefully it's still bug-free
contract BeethovenxMasterChef is Ownable {
    using SafeERC20 for IERC20;
    using EnumerableSet for EnumerableSet.AddressSet;

    // Info of each user.
    struct UserInfo {
        uint256 amount; // How many LP tokens the user has provided.
        uint256 rewardDebt; // Reward debt. See explanation below.
        //
        // We do some fancy math here. Basically, any point in time, the amount of BEETS
        // entitled to a user but is pending to be distributed is:
        //
        //   pending reward = (user.amount * pool.accBeetsPerShare) - user.rewardDebt
        //
        // Whenever a user deposits or withdraws LP tokens to a pool. Here's what happens:
        //   1. The pool's `accBeetsPerShare` (and `lastRewardBlock`) gets updated.
        //   2. User receives the pending reward sent to his/her address.
        //   3. User's `amount` gets updated.
        //   4. User's `rewardDebt` gets updated.
    }
    // Info of each pool.
    struct PoolInfo {
        // we have a fixed number of BEETS tokens released per block, each pool gets his fraction based on the allocPoint
        uint256 allocPoint; // How many allocation points assigned to this pool. the fraction BEETS to distribute per block.
        uint256 lastRewardBlock; // Last block number that BEETS distribution occurs.
        uint256 accBeetsPerShare; // Accumulated BEETS per LP share. this is multiplied by ACC_BEETS_PRECISION for more exact results (rounding errors)
    }
    // The BEETS TOKEN!
    BeethovenxToken public beets;

    // Treasury address.
    address public treasuryAddress;

    // BEETS tokens created per block.
    uint256 public beetsPerBlock;

    uint256 private constant ACC_BEETS_PRECISION = 1e12;

    // distribution percentages: a value of 1000 = 100%
    // 12.8% percentage of pool rewards that goes to the treasury.
    uint256 public constant TREASURY_PERCENTAGE = 128;

    // 87.2% percentage of pool rewards that goes to LP holders.
    uint256 public constant POOL_PERCENTAGE = 872;

    // Info of each pool.
    PoolInfo[] public poolInfo;
    // Info of each user that stakes LP tokens per pool. poolId => address => userInfo
    /// @notice Address of the LP token for each MCV pool.
    IERC20[] public lpTokens;

    EnumerableSet.AddressSet private lpTokenAddresses;

    /// @notice Address of each `IRewarder` contract in MCV.
    IRewarder[] public rewarder;

    mapping(uint256 => mapping(address => UserInfo)) public userInfo; // mapping form poolId => user Address => User Info
    // Total allocation points. Must be the sum of all allocation points in all pools.
    uint256 public totalAllocPoint = 0;
    // The block number when BEETS mining starts.
    uint256 public startBlock;

    event Deposit(
        address indexed user,
        uint256 indexed pid,
        uint256 amount,
        address indexed to
    );
    event Withdraw(
        address indexed user,
        uint256 indexed pid,
        uint256 amount,
        address indexed to
    );
    event EmergencyWithdraw(
        address indexed user,
        uint256 indexed pid,
        uint256 amount,
        address indexed to
    );
    event Harvest(address indexed user, uint256 indexed pid, uint256 amount);
    event LogPoolAddition(
        uint256 indexed pid,
        uint256 allocPoint,
        IERC20 indexed lpToken,
        IRewarder indexed rewarder
    );
    event LogSetPool(
        uint256 indexed pid,
        uint256 allocPoint,
        IRewarder indexed rewarder,
        bool overwrite
    );
    event LogUpdatePool(
        uint256 indexed pid,
        uint256 lastRewardBlock,
        uint256 lpSupply,
        uint256 accBeetsPerShare
    );
    event SetTreasuryAddress(
        address indexed oldAddress,
        address indexed newAddress
    );
    event UpdateEmissionRate(address indexed user, uint256 _beetsPerSec);

    constructor(
        BeethovenxToken _beets,
        address _treasuryAddress,
        uint256 _beetsPerBlock,
        uint256 _startBlock
    ) {
        require(
            _beetsPerBlock <= 6e18,
            "maximum emission rate of 6 beets per block exceeded"
        );
        beets = _beets;
        treasuryAddress = _treasuryAddress;
        beetsPerBlock = _beetsPerBlock;
        startBlock = _startBlock;
    }

    function poolLength() external view returns (uint256) {
        return poolInfo.length;
    }

    // Add a new lp to the pool. Can only be called by the owner.
    function add(
        uint256 _allocPoint,
        IERC20 _lpToken,
        IRewarder _rewarder
    ) public onlyOwner {
        require(
            Address.isContract(address(_lpToken)),
            "add: LP token must be a valid contract"
        );
        require(
            Address.isContract(address(_rewarder)) ||
                address(_rewarder) == address(0),
            "add: rewarder must be contract or zero"
        );
        // we make sure the same LP cannot be added twice which would cause trouble
        require(
            !lpTokenAddresses.contains(address(_lpToken)),
            "add: LP already added"
        );

        // respect startBlock!
        uint256 lastRewardBlock = block.number > startBlock
            ? block.number
            : startBlock;
        totalAllocPoint = totalAllocPoint + _allocPoint;

        // LP tokens, rewarders & pools are always on the same index which translates into the pid
        lpTokens.push(_lpToken);
        lpTokenAddresses.add(address(_lpToken));
        rewarder.push(_rewarder);

        poolInfo.push(
            PoolInfo({
                allocPoint: _allocPoint,
                lastRewardBlock: lastRewardBlock,
                accBeetsPerShare: 0
            })
        );
        emit LogPoolAddition(
            lpTokens.length - 1,
            _allocPoint,
            _lpToken,
            _rewarder
        );
    }

    // Update the given pool's BEETS allocation point. Can only be called by the owner.
    /// @param _pid The index of the pool. See `poolInfo`.
    /// @param _allocPoint New AP of the pool.
    /// @param _rewarder Address of the rewarder delegate.
    /// @param overwrite True if _rewarder should be `set`. Otherwise `_rewarder` is ignored.
    function set(
        uint256 _pid,
        uint256 _allocPoint,
        IRewarder _rewarder,
        bool overwrite
    ) public onlyOwner {
        require(
            Address.isContract(address(_rewarder)) ||
                address(_rewarder) == address(0),
            "set: rewarder must be contract or zero"
        );

        // we re-adjust the total allocation points
        totalAllocPoint =
            totalAllocPoint -
            poolInfo[_pid].allocPoint +
            _allocPoint;

        poolInfo[_pid].allocPoint = _allocPoint;

        if (overwrite) {
            rewarder[_pid] = _rewarder;
        }
        emit LogSetPool(
            _pid,
            _allocPoint,
            overwrite ? _rewarder : rewarder[_pid],
            overwrite
        );
    }

    // View function to see pending BEETS on frontend.
    function pendingBeets(uint256 _pid, address _user)
        external
        view
        returns (uint256 pending)
    {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][_user];
        // how many BEETS per lp token
        uint256 accBeetsPerShare = pool.accBeetsPerShare;
        // total staked lp tokens in this pool
        uint256 lpSupply = lpTokens[_pid].balanceOf(address(this));

        if (block.number > pool.lastRewardBlock && lpSupply != 0) {
            uint256 blocksSinceLastReward = block.number - pool.lastRewardBlock;
            // based on the pool weight (allocation points) we calculate the beets rewarded for this specific pool
            uint256 beetsRewards = (blocksSinceLastReward *
                beetsPerBlock *
                pool.allocPoint) / totalAllocPoint;

            // we take parts of the rewards for treasury, these can be subject to change, so we recalculate it
            // a value of 1000 = 100%
            uint256 beetsRewardsForPool = (beetsRewards * POOL_PERCENTAGE) /
                1000;

            // we calculate the new amount of accumulated beets per LP token
            accBeetsPerShare =
                accBeetsPerShare +
                ((beetsRewardsForPool * ACC_BEETS_PRECISION) / lpSupply);
        }
        // based on the number of LP tokens the user owns, we calculate the pending amount by subtracting the amount
        // which he is not eligible for (joined the pool later) or has already harvested
        pending =
            (user.amount * accBeetsPerShare) /
            ACC_BEETS_PRECISION -
            user.rewardDebt;
    }

    /// @notice Update reward variables for all pools. Be careful of gas spending!
    /// @param pids Pool IDs of all to be updated. Make sure to update all active pools.
    function massUpdatePools(uint256[] calldata pids) external {
        uint256 len = pids.length;
        for (uint256 i = 0; i < len; ++i) {
            updatePool(pids[i]);
        }
    }

    // Update reward variables of the given pool to be up-to-date.
    function updatePool(uint256 _pid) public returns (PoolInfo memory pool) {
        pool = poolInfo[_pid];

        if (block.number > pool.lastRewardBlock) {
            // total lp tokens staked for this pool
            uint256 lpSupply = lpTokens[_pid].balanceOf(address(this));
            if (lpSupply > 0) {
                uint256 blocksSinceLastReward = block.number -
                    pool.lastRewardBlock;

                // rewards for this pool based on his allocation points
                uint256 beetsRewards = (blocksSinceLastReward *
                    beetsPerBlock *
                    pool.allocPoint) / totalAllocPoint;

                uint256 beetsRewardsForPool = (beetsRewards * POOL_PERCENTAGE) /
                    1000;

                beets.mint(
                    treasuryAddress,
                    (beetsRewards * TREASURY_PERCENTAGE) / 1000
                );

                beets.mint(address(this), beetsRewardsForPool);

                pool.accBeetsPerShare =
                    pool.accBeetsPerShare +
                    ((beetsRewardsForPool * ACC_BEETS_PRECISION) / lpSupply);
            }
            pool.lastRewardBlock = block.number;
            poolInfo[_pid] = pool;

            emit LogUpdatePool(
                _pid,
                pool.lastRewardBlock,
                lpSupply,
                pool.accBeetsPerShare
            );
        }
    }

    // Deposit LP tokens to MasterChef for BEETS allocation.
    function deposit(
        uint256 _pid,
        uint256 _amount,
        address _to
    ) public {
        PoolInfo memory pool = updatePool(_pid);
        UserInfo storage user = userInfo[_pid][_to];

        user.amount = user.amount + _amount;
        // since we add more LP tokens, we have to keep track of the rewards he is not eligible for
        // if we would not do that, he would get rewards like he added them since the beginning of this pool
        // note that only the accBeetsPerShare have the precision applied
        user.rewardDebt =
            user.rewardDebt +
            (_amount * pool.accBeetsPerShare) /
            ACC_BEETS_PRECISION;

        IRewarder _rewarder = rewarder[_pid];
        if (address(_rewarder) != address(0)) {
            _rewarder.onBeetsReward(_pid, _to, _to, 0, user.amount);
        }

        lpTokens[_pid].safeTransferFrom(msg.sender, address(this), _amount);

        emit Deposit(msg.sender, _pid, _amount, _to);
    }

    function harvestAll(uint256[] calldata _pids, address _to) external {
        for (uint256 i = 0; i < _pids.length; i++) {
            if (userInfo[_pids[i]][msg.sender].amount > 0) {
                harvest(_pids[i], _to);
            }
        }
    }

    /// @notice Harvest proceeds for transaction sender to `_to`.
    /// @param _pid The index of the pool. See `poolInfo`.
    /// @param _to Receiver of BEETS rewards.
    function harvest(uint256 _pid, address _to) public {
        PoolInfo memory pool = updatePool(_pid);
        UserInfo storage user = userInfo[_pid][msg.sender];

        // this would  be the amount if the user joined right from the start of the farm
        uint256 accumulatedBeets = (user.amount * pool.accBeetsPerShare) /
            ACC_BEETS_PRECISION;
        // subtracting the rewards the user is not eligible for
        uint256 eligibleBeets = accumulatedBeets - user.rewardDebt;

        // we set the new rewardDebt to the current accumulated amount of rewards for his amount of LP token
        user.rewardDebt = accumulatedBeets;

        if (eligibleBeets > 0) {
            safeBeetsTransfer(_to, eligibleBeets);
        }

        IRewarder _rewarder = rewarder[_pid];
        if (address(_rewarder) != address(0)) {
            _rewarder.onBeetsReward(
                _pid,
                msg.sender,
                _to,
                eligibleBeets,
                user.amount
            );
        }

        emit Harvest(msg.sender, _pid, eligibleBeets);
    }

    /// @notice Withdraw LP tokens from MCV and harvest proceeds for transaction sender to `_to`.
    /// @param _pid The index of the pool. See `poolInfo`.
    /// @param _amount LP token amount to withdraw.
    /// @param _to Receiver of the LP tokens and BEETS rewards.
    function withdrawAndHarvest(
        uint256 _pid,
        uint256 _amount,
        address _to
    ) public {
        PoolInfo memory pool = updatePool(_pid);
        UserInfo storage user = userInfo[_pid][msg.sender];

        require(_amount <= user.amount, "cannot withdraw more than deposited");

        // this would  be the amount if the user joined right from the start of the farm
        uint256 accumulatedBeets = (user.amount * pool.accBeetsPerShare) /
            ACC_BEETS_PRECISION;
        // subtracting the rewards the user is not eligible for
        uint256 eligibleBeets = accumulatedBeets - user.rewardDebt;

        /*
            after harvest & withdraw, he should be eligible for exactly 0 tokens
            => userInfo.amount * pool.accBeetsPerShare / ACC_BEETS_PRECISION == userInfo.rewardDebt
            since we are removing some LP's from userInfo.amount, we also have to remove
            the equivalent amount of reward debt
        */

        user.rewardDebt =
            accumulatedBeets -
            (_amount * pool.accBeetsPerShare) /
            ACC_BEETS_PRECISION;
        user.amount = user.amount - _amount;

        safeBeetsTransfer(_to, eligibleBeets);

        IRewarder _rewarder = rewarder[_pid];
        if (address(_rewarder) != address(0)) {
            _rewarder.onBeetsReward(
                _pid,
                msg.sender,
                _to,
                eligibleBeets,
                user.amount
            );
        }

        lpTokens[_pid].safeTransfer(_to, _amount);

        emit Withdraw(msg.sender, _pid, _amount, _to);
        emit Harvest(msg.sender, _pid, eligibleBeets);
    }

    // Withdraw without caring about rewards. EMERGENCY ONLY.
    function emergencyWithdraw(uint256 _pid, address _to) public {
        UserInfo storage user = userInfo[_pid][msg.sender];
        uint256 amount = user.amount;
        user.amount = 0;
        user.rewardDebt = 0;

        IRewarder _rewarder = rewarder[_pid];
        if (address(_rewarder) != address(0)) {
            _rewarder.onBeetsReward(_pid, msg.sender, _to, 0, 0);
        }

        // Note: transfer can fail or succeed if `amount` is zero.
        lpTokens[_pid].safeTransfer(_to, amount);
        emit EmergencyWithdraw(msg.sender, _pid, amount, _to);
    }

    // Safe BEETS transfer function, just in case if rounding error causes pool to not have enough BEETS.
    function safeBeetsTransfer(address _to, uint256 _amount) internal {
        uint256 beetsBalance = beets.balanceOf(address(this));
        if (_amount > beetsBalance) {
            beets.transfer(_to, beetsBalance);
        } else {
            beets.transfer(_to, _amount);
        }
    }

    // Update treasury address by the owner.
    function treasury(address _treasuryAddress) public onlyOwner {
        treasuryAddress = _treasuryAddress;
        emit SetTreasuryAddress(treasuryAddress, _treasuryAddress);
    }

    function updateEmissionRate(uint256 _beetsPerBlock) public onlyOwner {
        require(
            _beetsPerBlock <= 6e18,
            "maximum emission rate of 6 beets per block exceeded"
        );
        beetsPerBlock = _beetsPerBlock;
        emit UpdateEmissionRate(msg.sender, _beetsPerBlock);
    }
}

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

pragma solidity ^0.8.0;

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

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

File 7 of 12 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

    /**
     * @dev Moves `amount` tokens from the caller's account to `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);

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

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

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 9 of 12 : ERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.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.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

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

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

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

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

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

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

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `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, _allowances[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 = _allowances[owner][spender];
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(owner, spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `sender` to `recipient`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `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;
        }
        _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;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);

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

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

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

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

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

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

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

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

    /**
     * @dev Spend `amount` form the allowance of `owner` toward `spender`.
     *
     * 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 {}
}

File 10 of 12 : IERC20Metadata.sol
// 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);
}

File 11 of 12 : EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

            return true;
        } else {
            return false;
        }
    }

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

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

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

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

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

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

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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

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

        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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

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

        assembly {
            result := store
        }

        return result;
    }
}

File 12 of 12 : BeethovenxToken.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.7;

import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract BeethovenxToken is ERC20("BeethovenxToken", "BEETS"), Ownable {
    uint256 public constant MAX_SUPPLY = 250_000_000e18; // 250 million beets

    /// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).
    function mint(address _to, uint256 _amount) public onlyOwner {
        require(
            totalSupply() + _amount <= MAX_SUPPLY,
            "BEETS::mint: cannot exceed max supply"
        );
        _mint(_to, _amount);
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_masterChef","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[],"name":"LogInit","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"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"LogOnReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"allocPoint","type":"uint256"}],"name":"LogPoolAddition","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"rewardPerSecond","type":"uint256"}],"name":"LogRewardPerSecond","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"allocPoint","type":"uint256"}],"name":"LogSetPool","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IERC20","name":"rewardToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"accTokenPrecision","type":"uint256"}],"name":"LogSetRewardToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lastRewardTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lpSupply","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"accRewardTokenPerShare","type":"uint256"}],"name":"LogUpdatePool","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"},{"inputs":[],"name":"accTokenPrecision","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid","type":"uint256"},{"internalType":"uint256","name":"allocPoint","type":"uint256"}],"name":"add","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ERC20","name":"token","type":"address"}],"name":"initializeRewardToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"pids","type":"uint256[]"}],"name":"massUpdatePools","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"masterChef","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"masterchefPoolIds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid","type":"uint256"},{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"newLpAmount","type":"uint256"}],"name":"onBeetsReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_user","type":"address"}],"name":"pendingToken","outputs":[{"internalType":"uint256","name":"pending","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid","type":"uint256"},{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"pendingTokens","outputs":[{"internalType":"contract IERC20[]","name":"rewardTokens","type":"address[]"},{"internalType":"uint256[]","name":"rewardAmounts","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolInfo","outputs":[{"internalType":"uint256","name":"accRewardTokenPerShare","type":"uint256"},{"internalType":"uint256","name":"lastRewardTime","type":"uint256"},{"internalType":"uint256","name":"allocPoint","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolLength","outputs":[{"internalType":"uint256","name":"pools","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardPerSecond","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"contract ERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid","type":"uint256"},{"internalType":"uint256","name":"allocPoint","type":"uint256"}],"name":"set","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rewardPerSecond","type":"uint256"}],"name":"setRewardPerSecond","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"withdrawRemainingFundsTo","type":"address"}],"name":"shutDown","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"topUpRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid","type":"uint256"}],"name":"updatePool","outputs":[{"components":[{"internalType":"uint256","name":"accRewardTokenPerShare","type":"uint256"},{"internalType":"uint256","name":"lastRewardTime","type":"uint256"},{"internalType":"uint256","name":"allocPoint","type":"uint256"}],"internalType":"struct TimeBasedMasterChefRewarder.PoolInfo","name":"pool","type":"tuple"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"userInfo","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"rewardDebt","type":"uint256"}],"stateMutability":"view","type":"function"}]

60a0604052600060065534801561001557600080fd5b5060405162001d7438038062001d74833981016040819052610036916100a4565b61003f33610054565b60601b6001600160601b0319166080526100d4565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156100b657600080fd5b81516001600160a01b03811681146100cd57600080fd5b9392505050565b60805160601c611c5e620001166000396000818161021c01528181610538015281816105c90152818161088d015281816109260152610dfd0152611c5e6000f3fe608060405234801561001057600080fd5b50600436106101425760003560e01c8063771602f7116100b8578063bc58d7951161007c578063bc58d7951461031e578063d63b3c4914610331578063e85f0a5114610352578063f2fde38b1461035b578063f7c618c11461036e578063ffb65f761461038157600080fd5b8063771602f7146102975780638da5cb5b146102aa5780638f10369a146102bb578063929bffc2146102c457806393f1a40b146102d757600080fd5b806351eb05a61161010a57806351eb05a6146101e2578063575a86b21461021757806357a5b58c1461025657806366da581514610269578063715018a61461027c57806372f3ac8b1461028457600080fd5b8063081e3eda146101475780631526fe271461015e5780631ab06ee5146101a75780631c671763146101bc57806348e43af4146101cf575b600080fd5b6003545b6040519081526020015b60405180910390f35b61018c61016c3660046117c2565b600260208190526000918252604090912080546001820154919092015483565b60408051938452602084019290925290820152606001610155565b6101ba6101b53660046118ae565b610394565b005b61014b6101ca3660046117c2565b61049d565b61014b6101dd3660046117f4565b6104be565b6101f56101f03660046117c2565b610805565b6040805182518152602080840151908201529181015190820152606001610155565b61023e7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610155565b6101ba61026436600461170e565b610a95565b6101ba6102773660046117c2565b610ad9565b6101ba610b3e565b6101ba6102923660046116f1565b610b74565b6101ba6102a53660046118ae565b610caf565b6000546001600160a01b031661023e565b61014b60065481565b6101ba6102d2366004611824565b610df2565b6103096102e53660046117f4565b60046020908152600092835260408084209091529082529020805460019091015482565b60408051928352602083019190915201610155565b6101ba61032c3660046117c2565b611073565b61034461033f366004611876565b61108e565b60405161015592919061190f565b61014b60075481565b6101ba6103693660046116f1565b611146565b60015461023e906001600160a01b031681565b6101ba61038f3660046116f1565b6111de565b6000546001600160a01b031633146103c75760405162461bcd60e51b81526004016103be906119c6565b60405180910390fd5b60008281526002602052604090206001015461041b5760405162461bcd60e51b8152602060048201526013602482015272141bdbdb08191bd95cc81b9bdd08195e1a5cdd606a1b60448201526064016103be565b60008281526002602081905260409091200154600554829161043c91611b66565b61044691906119fb565b600555600082815260026020819052604091829020018290555182907f942cc7e17a17c164bd977f32ab8c54265d5b9d481e4e352bf874f1e568874e7c906104919084815260200190565b60405180910390a25050565b600381815481106104ad57600080fd5b600091825260209091200154905081565b60008281526002602081815260408084208151606081018352815481526001820154938101849052930154908301526104fa57600091506107fe565b60008481526004602081815260408084206001600160a01b0388811686529252808420855191516306ed78b760e21b815293840189905293909290917f00000000000000000000000000000000000000000000000000000000000000001690631bb5e2dc9060240160206040518083038186803b15801561057a57600080fd5b505afa15801561058e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105b291906117a5565b6040516370a0823160e01b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116600483015291909116906370a082319060240160206040518083038186803b15801561061557600080fd5b505afa158015610629573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064d91906117db565b905083602001514211801561066157508015155b156106d05760008460200151426106789190611b66565b905060006005548660400151600654846106929190611b47565b61069c9190611b47565b6106a69190611a38565b905082600754826106b79190611b47565b6106c19190611a38565b6106cb90856119fb565b935050505b600183015460075484546106e5908590611b47565b6106ef9190611a38565b6106f99190611b66565b6001546040516370a0823160e01b81523060048201529196506001600160a01b0316906370a082319060240160206040518083038186803b15801561073d57600080fd5b505afa158015610751573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061077591906117db565b8511156107fa576001546040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b1580156107bf57600080fd5b505afa1580156107d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107f791906117db565b94505b5050505b5092915050565b61082960405180606001604052806000815260200160008152602001600081525090565b50600081815260026020818152604092839020835160608101855281548152600182015492810183905292015492820192909252901580159061086f5750806020015142115b15610a90576040516306ed78b760e21b8152600481018390526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690631bb5e2dc9060240160206040518083038186803b1580156108d757600080fd5b505afa1580156108eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090f91906117a5565b6040516370a0823160e01b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116600483015291909116906370a082319060240160206040518083038186803b15801561097257600080fd5b505afa158015610986573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109aa91906117db565b90508015610a1e5760008260200151426109c49190611b66565b905060006005548460400151600654846109de9190611b47565b6109e89190611b47565b6109f29190611a38565b90508260075482610a039190611b47565b610a0d9190611a38565b8451610a1991906119fb565b845250505b426020838101918252600085815260028083526040918290208651808255945160018201819055838801519190920155815190815291820184905281019190915283907fcb7325664a4a3b7c7223eefc492a97ca4fdf94d46884621e5a8fae5a04b2b9d29060600160405180910390a2505b919050565b8060005b81811015610ad357610ac2848483818110610ab657610ab6611bfd565b90506020020135610805565b50610acc81611bcc565b9050610a99565b50505050565b6000546001600160a01b03163314610b035760405162461bcd60e51b81526004016103be906119c6565b60068190556040518181527fde89cb17ac7f58f94792b3e91e086ed85403819c24ceea882491f960ccb1a2789060200160405180910390a150565b6000546001600160a01b03163314610b685760405162461bcd60e51b81526004016103be906119c6565b610b7260006113ac565b565b6000546001600160a01b03163314610b9e5760405162461bcd60e51b81526004016103be906119c6565b610ba86000610ad9565b6001546040516370a0823160e01b81523060048201526001600160a01b039091169063a9059cbb90839083906370a082319060240160206040518083038186803b158015610bf557600080fd5b505afa158015610c09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c2d91906117db565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b158015610c7357600080fd5b505af1158015610c87573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cab9190611783565b5050565b6000546001600160a01b03163314610cd95760405162461bcd60e51b81526004016103be906119c6565b60008281526002602052604090206001015415610d2e5760405162461bcd60e51b8152602060048201526013602482015272506f6f6c20616c72656164792065786973747360681b60448201526064016103be565b6005544290610d3e9083906119fb565b60055560408051606081018252600080825260208083018581528385018781528884526002928390528584209451855590516001808601919091559051939091019290925560038054928301815590527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b018490555183907f38410508059921573ab9ebdca2a5034be738d236366b8f32de4434ea95ed3c8190610de59085815260200190565b60405180910390a2505050565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610e7a5760405162461bcd60e51b815260206004820152602760248201527f4f6e6c79204d6173746572436865662063616e2063616c6c20746869732066756044820152663731ba34b7b71760c91b60648201526084016103be565b6000610e8586610805565b60008781526004602090815260408083206001600160a01b038a168452909152812080549293509115610fdd57600182015460075484518454610ec89190611b47565b610ed29190611a38565b610edc9190611b66565b6001546040516370a0823160e01b81523060048201529192506001600160a01b0316906370a082319060240160206040518083038186803b158015610f2057600080fd5b505afa158015610f34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5891906117db565b811115610fdd576001546040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b158015610fa257600080fd5b505afa158015610fb6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fda91906117db565b90505b8382556007548351610fef9086611b47565b610ff99190611a38565b6001830155801561101b5760015461101b906001600160a01b031687836113fc565b856001600160a01b031688886001600160a01b03167f2ece88ca2bc08dd018db50e1d25a20bf1241e5fab1c396caa51f01a54bd2f75b8460405161106191815260200190565b60405180910390a45050505050505050565b60015461108b906001600160a01b0316333084611464565b50565b604080516001808252818301909252606091829160009160208083019080368337505060015482519293506001600160a01b0316918391506000906110d5576110d5611bfd565b6001600160a01b03929092166020928302919091019091015260408051600180825281830190925260009181602001602082028036833701905050905061111c87876104be565b8160008151811061112f5761112f611bfd565b602090810291909101015290969095509350505050565b6000546001600160a01b031633146111705760405162461bcd60e51b81526004016103be906119c6565b6001600160a01b0381166111d55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016103be565b61108b816113ac565b6000546001600160a01b031633146112085760405162461bcd60e51b81526004016103be906119c6565b6001546001600160a01b03161561126b5760405162461bcd60e51b815260206004820152602160248201527f52657761726420746f6b656e2063616e206f6e6c7920626520736574206f6e636044820152606560f81b60648201526084016103be565b6000816001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156112a657600080fd5b505afa1580156112ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112de91906118d0565b905060128160ff1611156113345760405162461bcd60e51b815260206004820152601d60248201527f6d6178696d756d20313820646563696d616c7320737570706f7274656400000060448201526064016103be565b61133f816012611b7d565b61134a90600c611a13565b6113589060ff16600a611a9d565b6007819055600180546001600160a01b0319166001600160a01b038516908117909155604051918252907fae847e1b5f7808e0679b93bcfacb36422bed2a08eae269654477efb8b66064cb90602001610491565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040516001600160a01b03831660248201526044810182905261145f90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261149c565b505050565b6040516001600160a01b0380851660248301528316604482015260648101829052610ad39085906323b872dd60e01b90608401611428565b60006114f1826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661156e9092919063ffffffff16565b80519091501561145f578080602001905181019061150f9190611783565b61145f5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103be565b606061157d8484600085611587565b90505b9392505050565b6060824710156115e85760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016103be565b6001600160a01b0385163b61163f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103be565b600080866001600160a01b0316858760405161165b91906118f3565b60006040518083038185875af1925050503d8060008114611698576040519150601f19603f3d011682016040523d82523d6000602084013e61169d565b606091505b50915091506116ad8282866116b8565b979650505050505050565b606083156116c7575081611580565b8251156116d75782518084602001fd5b8160405162461bcd60e51b81526004016103be9190611993565b60006020828403121561170357600080fd5b813561158081611c13565b6000806020838503121561172157600080fd5b823567ffffffffffffffff8082111561173957600080fd5b818501915085601f83011261174d57600080fd5b81358181111561175c57600080fd5b8660208260051b850101111561177157600080fd5b60209290920196919550909350505050565b60006020828403121561179557600080fd5b8151801515811461158057600080fd5b6000602082840312156117b757600080fd5b815161158081611c13565b6000602082840312156117d457600080fd5b5035919050565b6000602082840312156117ed57600080fd5b5051919050565b6000806040838503121561180757600080fd5b82359150602083013561181981611c13565b809150509250929050565b600080600080600060a0868803121561183c57600080fd5b85359450602086013561184e81611c13565b9350604086013561185e81611c13565b94979396509394606081013594506080013592915050565b60008060006060848603121561188b57600080fd5b83359250602084013561189d81611c13565b929592945050506040919091013590565b600080604083850312156118c157600080fd5b50508035926020909101359150565b6000602082840312156118e257600080fd5b815160ff8116811461158057600080fd5b60008251611905818460208701611ba0565b9190910192915050565b604080825283519082018190526000906020906060840190828701845b828110156119515781516001600160a01b03168452928401929084019060010161192c565b5050508381038285015284518082528583019183019060005b818110156119865783518352928401929184019160010161196a565b5090979650505050505050565b60208152600082518060208401526119b2816040850160208701611ba0565b601f01601f19169190910160400192915050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60008219821115611a0e57611a0e611be7565b500190565b600060ff821660ff84168060ff03821115611a3057611a30611be7565b019392505050565b600082611a5557634e487b7160e01b600052601260045260246000fd5b500490565b600181815b80851115611a95578160001904821115611a7b57611a7b611be7565b80851615611a8857918102915b93841c9390800290611a5f565b509250929050565b60006115808383600082611ab357506001611b41565b81611ac057506000611b41565b8160018114611ad65760028114611ae057611afc565b6001915050611b41565b60ff841115611af157611af1611be7565b50506001821b611b41565b5060208310610133831016604e8410600b8410161715611b1f575081810a611b41565b611b298383611a5a565b8060001904821115611b3d57611b3d611be7565b0290505b92915050565b6000816000190483118215151615611b6157611b61611be7565b500290565b600082821015611b7857611b78611be7565b500390565b600060ff821660ff841680821015611b9757611b97611be7565b90039392505050565b60005b83811015611bbb578181015183820152602001611ba3565b83811115610ad35750506000910152565b6000600019821415611be057611be0611be7565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6001600160a01b038116811461108b57600080fdfea26469706673582212204d471dffa0878e06373f8e2678664c0a69d873522a829dd8338e449f8f63339d64736f6c634300080700330000000000000000000000008166994d9ebbe5829ec86bd81258149b87facfd3

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101425760003560e01c8063771602f7116100b8578063bc58d7951161007c578063bc58d7951461031e578063d63b3c4914610331578063e85f0a5114610352578063f2fde38b1461035b578063f7c618c11461036e578063ffb65f761461038157600080fd5b8063771602f7146102975780638da5cb5b146102aa5780638f10369a146102bb578063929bffc2146102c457806393f1a40b146102d757600080fd5b806351eb05a61161010a57806351eb05a6146101e2578063575a86b21461021757806357a5b58c1461025657806366da581514610269578063715018a61461027c57806372f3ac8b1461028457600080fd5b8063081e3eda146101475780631526fe271461015e5780631ab06ee5146101a75780631c671763146101bc57806348e43af4146101cf575b600080fd5b6003545b6040519081526020015b60405180910390f35b61018c61016c3660046117c2565b600260208190526000918252604090912080546001820154919092015483565b60408051938452602084019290925290820152606001610155565b6101ba6101b53660046118ae565b610394565b005b61014b6101ca3660046117c2565b61049d565b61014b6101dd3660046117f4565b6104be565b6101f56101f03660046117c2565b610805565b6040805182518152602080840151908201529181015190820152606001610155565b61023e7f0000000000000000000000008166994d9ebbe5829ec86bd81258149b87facfd381565b6040516001600160a01b039091168152602001610155565b6101ba61026436600461170e565b610a95565b6101ba6102773660046117c2565b610ad9565b6101ba610b3e565b6101ba6102923660046116f1565b610b74565b6101ba6102a53660046118ae565b610caf565b6000546001600160a01b031661023e565b61014b60065481565b6101ba6102d2366004611824565b610df2565b6103096102e53660046117f4565b60046020908152600092835260408084209091529082529020805460019091015482565b60408051928352602083019190915201610155565b6101ba61032c3660046117c2565b611073565b61034461033f366004611876565b61108e565b60405161015592919061190f565b61014b60075481565b6101ba6103693660046116f1565b611146565b60015461023e906001600160a01b031681565b6101ba61038f3660046116f1565b6111de565b6000546001600160a01b031633146103c75760405162461bcd60e51b81526004016103be906119c6565b60405180910390fd5b60008281526002602052604090206001015461041b5760405162461bcd60e51b8152602060048201526013602482015272141bdbdb08191bd95cc81b9bdd08195e1a5cdd606a1b60448201526064016103be565b60008281526002602081905260409091200154600554829161043c91611b66565b61044691906119fb565b600555600082815260026020819052604091829020018290555182907f942cc7e17a17c164bd977f32ab8c54265d5b9d481e4e352bf874f1e568874e7c906104919084815260200190565b60405180910390a25050565b600381815481106104ad57600080fd5b600091825260209091200154905081565b60008281526002602081815260408084208151606081018352815481526001820154938101849052930154908301526104fa57600091506107fe565b60008481526004602081815260408084206001600160a01b0388811686529252808420855191516306ed78b760e21b815293840189905293909290917f0000000000000000000000008166994d9ebbe5829ec86bd81258149b87facfd31690631bb5e2dc9060240160206040518083038186803b15801561057a57600080fd5b505afa15801561058e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105b291906117a5565b6040516370a0823160e01b81526001600160a01b037f0000000000000000000000008166994d9ebbe5829ec86bd81258149b87facfd38116600483015291909116906370a082319060240160206040518083038186803b15801561061557600080fd5b505afa158015610629573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064d91906117db565b905083602001514211801561066157508015155b156106d05760008460200151426106789190611b66565b905060006005548660400151600654846106929190611b47565b61069c9190611b47565b6106a69190611a38565b905082600754826106b79190611b47565b6106c19190611a38565b6106cb90856119fb565b935050505b600183015460075484546106e5908590611b47565b6106ef9190611a38565b6106f99190611b66565b6001546040516370a0823160e01b81523060048201529196506001600160a01b0316906370a082319060240160206040518083038186803b15801561073d57600080fd5b505afa158015610751573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061077591906117db565b8511156107fa576001546040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b1580156107bf57600080fd5b505afa1580156107d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107f791906117db565b94505b5050505b5092915050565b61082960405180606001604052806000815260200160008152602001600081525090565b50600081815260026020818152604092839020835160608101855281548152600182015492810183905292015492820192909252901580159061086f5750806020015142115b15610a90576040516306ed78b760e21b8152600481018390526000907f0000000000000000000000008166994d9ebbe5829ec86bd81258149b87facfd36001600160a01b031690631bb5e2dc9060240160206040518083038186803b1580156108d757600080fd5b505afa1580156108eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090f91906117a5565b6040516370a0823160e01b81526001600160a01b037f0000000000000000000000008166994d9ebbe5829ec86bd81258149b87facfd38116600483015291909116906370a082319060240160206040518083038186803b15801561097257600080fd5b505afa158015610986573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109aa91906117db565b90508015610a1e5760008260200151426109c49190611b66565b905060006005548460400151600654846109de9190611b47565b6109e89190611b47565b6109f29190611a38565b90508260075482610a039190611b47565b610a0d9190611a38565b8451610a1991906119fb565b845250505b426020838101918252600085815260028083526040918290208651808255945160018201819055838801519190920155815190815291820184905281019190915283907fcb7325664a4a3b7c7223eefc492a97ca4fdf94d46884621e5a8fae5a04b2b9d29060600160405180910390a2505b919050565b8060005b81811015610ad357610ac2848483818110610ab657610ab6611bfd565b90506020020135610805565b50610acc81611bcc565b9050610a99565b50505050565b6000546001600160a01b03163314610b035760405162461bcd60e51b81526004016103be906119c6565b60068190556040518181527fde89cb17ac7f58f94792b3e91e086ed85403819c24ceea882491f960ccb1a2789060200160405180910390a150565b6000546001600160a01b03163314610b685760405162461bcd60e51b81526004016103be906119c6565b610b7260006113ac565b565b6000546001600160a01b03163314610b9e5760405162461bcd60e51b81526004016103be906119c6565b610ba86000610ad9565b6001546040516370a0823160e01b81523060048201526001600160a01b039091169063a9059cbb90839083906370a082319060240160206040518083038186803b158015610bf557600080fd5b505afa158015610c09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c2d91906117db565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b158015610c7357600080fd5b505af1158015610c87573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cab9190611783565b5050565b6000546001600160a01b03163314610cd95760405162461bcd60e51b81526004016103be906119c6565b60008281526002602052604090206001015415610d2e5760405162461bcd60e51b8152602060048201526013602482015272506f6f6c20616c72656164792065786973747360681b60448201526064016103be565b6005544290610d3e9083906119fb565b60055560408051606081018252600080825260208083018581528385018781528884526002928390528584209451855590516001808601919091559051939091019290925560038054928301815590527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b018490555183907f38410508059921573ab9ebdca2a5034be738d236366b8f32de4434ea95ed3c8190610de59085815260200190565b60405180910390a2505050565b336001600160a01b037f0000000000000000000000008166994d9ebbe5829ec86bd81258149b87facfd31614610e7a5760405162461bcd60e51b815260206004820152602760248201527f4f6e6c79204d6173746572436865662063616e2063616c6c20746869732066756044820152663731ba34b7b71760c91b60648201526084016103be565b6000610e8586610805565b60008781526004602090815260408083206001600160a01b038a168452909152812080549293509115610fdd57600182015460075484518454610ec89190611b47565b610ed29190611a38565b610edc9190611b66565b6001546040516370a0823160e01b81523060048201529192506001600160a01b0316906370a082319060240160206040518083038186803b158015610f2057600080fd5b505afa158015610f34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5891906117db565b811115610fdd576001546040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b158015610fa257600080fd5b505afa158015610fb6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fda91906117db565b90505b8382556007548351610fef9086611b47565b610ff99190611a38565b6001830155801561101b5760015461101b906001600160a01b031687836113fc565b856001600160a01b031688886001600160a01b03167f2ece88ca2bc08dd018db50e1d25a20bf1241e5fab1c396caa51f01a54bd2f75b8460405161106191815260200190565b60405180910390a45050505050505050565b60015461108b906001600160a01b0316333084611464565b50565b604080516001808252818301909252606091829160009160208083019080368337505060015482519293506001600160a01b0316918391506000906110d5576110d5611bfd565b6001600160a01b03929092166020928302919091019091015260408051600180825281830190925260009181602001602082028036833701905050905061111c87876104be565b8160008151811061112f5761112f611bfd565b602090810291909101015290969095509350505050565b6000546001600160a01b031633146111705760405162461bcd60e51b81526004016103be906119c6565b6001600160a01b0381166111d55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016103be565b61108b816113ac565b6000546001600160a01b031633146112085760405162461bcd60e51b81526004016103be906119c6565b6001546001600160a01b03161561126b5760405162461bcd60e51b815260206004820152602160248201527f52657761726420746f6b656e2063616e206f6e6c7920626520736574206f6e636044820152606560f81b60648201526084016103be565b6000816001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156112a657600080fd5b505afa1580156112ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112de91906118d0565b905060128160ff1611156113345760405162461bcd60e51b815260206004820152601d60248201527f6d6178696d756d20313820646563696d616c7320737570706f7274656400000060448201526064016103be565b61133f816012611b7d565b61134a90600c611a13565b6113589060ff16600a611a9d565b6007819055600180546001600160a01b0319166001600160a01b038516908117909155604051918252907fae847e1b5f7808e0679b93bcfacb36422bed2a08eae269654477efb8b66064cb90602001610491565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040516001600160a01b03831660248201526044810182905261145f90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261149c565b505050565b6040516001600160a01b0380851660248301528316604482015260648101829052610ad39085906323b872dd60e01b90608401611428565b60006114f1826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661156e9092919063ffffffff16565b80519091501561145f578080602001905181019061150f9190611783565b61145f5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103be565b606061157d8484600085611587565b90505b9392505050565b6060824710156115e85760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016103be565b6001600160a01b0385163b61163f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103be565b600080866001600160a01b0316858760405161165b91906118f3565b60006040518083038185875af1925050503d8060008114611698576040519150601f19603f3d011682016040523d82523d6000602084013e61169d565b606091505b50915091506116ad8282866116b8565b979650505050505050565b606083156116c7575081611580565b8251156116d75782518084602001fd5b8160405162461bcd60e51b81526004016103be9190611993565b60006020828403121561170357600080fd5b813561158081611c13565b6000806020838503121561172157600080fd5b823567ffffffffffffffff8082111561173957600080fd5b818501915085601f83011261174d57600080fd5b81358181111561175c57600080fd5b8660208260051b850101111561177157600080fd5b60209290920196919550909350505050565b60006020828403121561179557600080fd5b8151801515811461158057600080fd5b6000602082840312156117b757600080fd5b815161158081611c13565b6000602082840312156117d457600080fd5b5035919050565b6000602082840312156117ed57600080fd5b5051919050565b6000806040838503121561180757600080fd5b82359150602083013561181981611c13565b809150509250929050565b600080600080600060a0868803121561183c57600080fd5b85359450602086013561184e81611c13565b9350604086013561185e81611c13565b94979396509394606081013594506080013592915050565b60008060006060848603121561188b57600080fd5b83359250602084013561189d81611c13565b929592945050506040919091013590565b600080604083850312156118c157600080fd5b50508035926020909101359150565b6000602082840312156118e257600080fd5b815160ff8116811461158057600080fd5b60008251611905818460208701611ba0565b9190910192915050565b604080825283519082018190526000906020906060840190828701845b828110156119515781516001600160a01b03168452928401929084019060010161192c565b5050508381038285015284518082528583019183019060005b818110156119865783518352928401929184019160010161196a565b5090979650505050505050565b60208152600082518060208401526119b2816040850160208701611ba0565b601f01601f19169190910160400192915050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60008219821115611a0e57611a0e611be7565b500190565b600060ff821660ff84168060ff03821115611a3057611a30611be7565b019392505050565b600082611a5557634e487b7160e01b600052601260045260246000fd5b500490565b600181815b80851115611a95578160001904821115611a7b57611a7b611be7565b80851615611a8857918102915b93841c9390800290611a5f565b509250929050565b60006115808383600082611ab357506001611b41565b81611ac057506000611b41565b8160018114611ad65760028114611ae057611afc565b6001915050611b41565b60ff841115611af157611af1611be7565b50506001821b611b41565b5060208310610133831016604e8410600b8410161715611b1f575081810a611b41565b611b298383611a5a565b8060001904821115611b3d57611b3d611be7565b0290505b92915050565b6000816000190483118215151615611b6157611b61611be7565b500290565b600082821015611b7857611b78611be7565b500390565b600060ff821660ff841680821015611b9757611b97611be7565b90039392505050565b60005b83811015611bbb578181015183820152602001611ba3565b83811115610ad35750506000910152565b6000600019821415611be057611be0611be7565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6001600160a01b038116811461108b57600080fdfea26469706673582212204d471dffa0878e06373f8e2678664c0a69d873522a829dd8338e449f8f63339d64736f6c63430008070033

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

0000000000000000000000008166994d9ebbe5829ec86bd81258149b87facfd3

-----Decoded View---------------
Arg [0] : _masterChef (address): 0x8166994d9ebBe5829EC86Bd81258149B87faCfd3

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000008166994d9ebbe5829ec86bd81258149b87facfd3


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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