S Price: $0.067538 (-3.97%)
Gas: 55 Gwei

Contract

0x0dCEfFA49d439625b93c698ce60aB98cEd3dE9f3
Transaction Hash
Block
From
To
Deposit611887312026-01-26 11:39:521 hr ago1769427592IN
0x0dCEfFA4...cEd3dE9f3
0 S0.0084892555
Deposit611887132026-01-26 11:39:301 hr ago1769427570IN
0x0dCEfFA4...cEd3dE9f3
0 S0.0084892555
Deposit611849032026-01-26 10:20:002 hrs ago1769422800IN
0x0dCEfFA4...cEd3dE9f3
0 S0.007717550
Deposit611848772026-01-26 10:19:222 hrs ago1769422762IN
0x0dCEfFA4...cEd3dE9f3
0 S0.007717550
Deposit611848582026-01-26 10:18:542 hrs ago1769422734IN
0x0dCEfFA4...cEd3dE9f3
0 S0.0084892555
Deposit611848442026-01-26 10:18:352 hrs ago1769422715IN
0x0dCEfFA4...cEd3dE9f3
0 S0.0077168550
Deposit611647162026-01-26 4:03:539 hrs ago1769400233IN
0x0dCEfFA4...cEd3dE9f3
0 S0.0073393150.0001
Deposit611646902026-01-26 4:03:169 hrs ago1769400196IN
0x0dCEfFA4...cEd3dE9f3
0 S0.0073393150.0001
Deposit611534852026-01-26 0:52:1412 hrs ago1769388734IN
0x0dCEfFA4...cEd3dE9f3
0 S0.0092930550
Deposit611511162026-01-26 0:13:2312 hrs ago1769386403IN
0x0dCEfFA4...cEd3dE9f3
0 S0.007717550
Deposit611493542026-01-25 23:46:4213 hrs ago1769384802IN
0x0dCEfFA4...cEd3dE9f3
0 S0.0100251550.001
Deposit611487852026-01-25 23:37:0613 hrs ago1769384226IN
0x0dCEfFA4...cEd3dE9f3
0 S0.007717550
Deposit611487522026-01-25 23:36:2913 hrs ago1769384189IN
0x0dCEfFA4...cEd3dE9f3
0 S0.007717550
Deposit611486962026-01-25 23:35:3713 hrs ago1769384137IN
0x0dCEfFA4...cEd3dE9f3
0 S0.007717550
Deposit611486302026-01-25 23:34:4813 hrs ago1769384088IN
0x0dCEfFA4...cEd3dE9f3
0 S0.007717550
Deposit611485502026-01-25 23:33:4513 hrs ago1769384025IN
0x0dCEfFA4...cEd3dE9f3
0 S0.007717550
Deposit611485202026-01-25 23:33:0713 hrs ago1769383987IN
0x0dCEfFA4...cEd3dE9f3
0 S0.0077168550
Deposit611311932026-01-25 19:18:4117 hrs ago1769368721IN
0x0dCEfFA4...cEd3dE9f3
0 S0.0073393150.0001
Deposit611167922026-01-25 15:19:1121 hrs ago1769354351IN
0x0dCEfFA4...cEd3dE9f3
0 S0.0073393150.0001
Deposit611127652026-01-25 13:51:3223 hrs ago1769349092IN
0x0dCEfFA4...cEd3dE9f3
0 S0.0073393150.0001
Deposit611127432026-01-25 13:51:0323 hrs ago1769349063IN
0x0dCEfFA4...cEd3dE9f3
0 S0.0073393150.0001
Deposit610866902026-01-25 3:06:3934 hrs ago1769310399IN
0x0dCEfFA4...cEd3dE9f3
0 S0.0073393150.0001
Deposit610866312026-01-25 3:05:1634 hrs ago1769310316IN
0x0dCEfFA4...cEd3dE9f3
0 S0.0073393150.0001
Deposit610827892026-01-25 1:28:4135 hrs ago1769304521IN
0x0dCEfFA4...cEd3dE9f3
0 S0.0099847555
Deposit610824612026-01-25 1:20:1435 hrs ago1769304014IN
0x0dCEfFA4...cEd3dE9f3
0 S0.007717550
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
611887312026-01-26 11:39:521 hr ago1769427592
0x0dCEfFA4...cEd3dE9f3
0 S
611887312026-01-26 11:39:521 hr ago1769427592
0x0dCEfFA4...cEd3dE9f3
0 S
611887312026-01-26 11:39:521 hr ago1769427592
0x0dCEfFA4...cEd3dE9f3
0 S
611887312026-01-26 11:39:521 hr ago1769427592
0x0dCEfFA4...cEd3dE9f3
0 S
611887312026-01-26 11:39:521 hr ago1769427592
0x0dCEfFA4...cEd3dE9f3
0 S
611887312026-01-26 11:39:521 hr ago1769427592
0x0dCEfFA4...cEd3dE9f3
0 S
611887312026-01-26 11:39:521 hr ago1769427592
0x0dCEfFA4...cEd3dE9f3
0 S
611887132026-01-26 11:39:301 hr ago1769427570
0x0dCEfFA4...cEd3dE9f3
0 S
611887132026-01-26 11:39:301 hr ago1769427570
0x0dCEfFA4...cEd3dE9f3
0 S
611887132026-01-26 11:39:301 hr ago1769427570
0x0dCEfFA4...cEd3dE9f3
0 S
611887132026-01-26 11:39:301 hr ago1769427570
0x0dCEfFA4...cEd3dE9f3
0 S
611887132026-01-26 11:39:301 hr ago1769427570
0x0dCEfFA4...cEd3dE9f3
0 S
611887132026-01-26 11:39:301 hr ago1769427570
0x0dCEfFA4...cEd3dE9f3
0 S
611887132026-01-26 11:39:301 hr ago1769427570
0x0dCEfFA4...cEd3dE9f3
0 S
611849032026-01-26 10:20:002 hrs ago1769422800
0x0dCEfFA4...cEd3dE9f3
0 S
611849032026-01-26 10:20:002 hrs ago1769422800
0x0dCEfFA4...cEd3dE9f3
0 S
611849032026-01-26 10:20:002 hrs ago1769422800
0x0dCEfFA4...cEd3dE9f3
0 S
611849032026-01-26 10:20:002 hrs ago1769422800
0x0dCEfFA4...cEd3dE9f3
0 S
611849032026-01-26 10:20:002 hrs ago1769422800
0x0dCEfFA4...cEd3dE9f3
0 S
611849032026-01-26 10:20:002 hrs ago1769422800
0x0dCEfFA4...cEd3dE9f3
0 S
611849032026-01-26 10:20:002 hrs ago1769422800
0x0dCEfFA4...cEd3dE9f3
0 S
611848772026-01-26 10:19:222 hrs ago1769422762
0x0dCEfFA4...cEd3dE9f3
0 S
611848772026-01-26 10:19:222 hrs ago1769422762
0x0dCEfFA4...cEd3dE9f3
0 S
611848772026-01-26 10:19:222 hrs ago1769422762
0x0dCEfFA4...cEd3dE9f3
0 S
611848772026-01-26 10:19:222 hrs ago1769422762
0x0dCEfFA4...cEd3dE9f3
0 S
View All Internal Transactions
Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
MasterChef

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Multicall.sol";

// Import interfaces
import "./interfaces/IRewardToken.sol";
import "./interfaces/IPair.sol";

contract MasterChef is ReentrancyGuard, Ownable, Multicall {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;
    using SafeERC20 for IRewardToken;
    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.
    }

    // Info of each pool.
    struct PoolInfo {
        IERC20 token; // Address of LP token contract.
        uint256 allocPoint; // How many allocation points assigned to this pool. rewardToken to distribute per block.
        uint256 lastRewardTime; // Last time that rewardToken distribution occurs.
        uint16 depositFeeBP; //depositfee
        uint16 withdrawFeeBP; //withdrawfee
        uint256 accTokensPerShare; // Accumulated rewardToken per share, times 1e18. See below.
        bool isStarted; // if lastRewardTime has passed
        uint256 lpBalance;
    }

    struct PoolView {
        uint256 pid;
        address token;
        uint256 allocPoint;
        uint256 lastRewardTime;
        uint16 depositFeeBP;
        uint16 withdrawFeeBP;
        uint256 accTokensPerShare;
        bool isStarted;
        uint256 lpBalance;
        uint256 rewardsPerSecond;
    }

    struct UserView {
        uint256 pid;
        uint256 stakedAmount;
        uint256 unclaimedRewards;
        uint256 lpBalance;
        uint256 allowance;
    }

    IRewardToken public rewardToken;

    // Info of each pool.W
    PoolInfo[] public poolInfo;
    EnumerableSet.AddressSet private lpTokens;

    // Info of each user that stakes LP tokens.
    mapping(uint256 => mapping(address => UserInfo)) public userInfo;

    // Total allocation points. Must be the sum of all allocation points in all pools.
    uint256 public totalAllocPoint = 0;

    // The time when rewardToken mining starts.
    uint256 public startTime;
    address public feeAddress;
    address public devAddress;
    uint256 public feePercent;
    uint256 public devPercent;
    uint256 public rewardsPerSec;
    uint256 public constant MAX_REWARDS_PER_SEC = 25 ether;
    uint256 public referralRate = 500;
    mapping(address => address) public referral; // referral => referrer
    mapping(address => uint256) public referralEarned; // for stats

    event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
    event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
    event EmergencyWithdraw(
        address indexed user,
        uint256 indexed pid,
        uint256 amount
    );
    event RewardPaid(address indexed user, uint256 amount);

    constructor(
        IRewardToken _rewardToken,
        address _feeAddress,
        address _devAddress,
        uint256 _feePercent,
        uint256 _devPercent,
        uint256 _rewardsPerSec,
        uint256 _startTime
    ) {
        require(_rewardsPerSec <= MAX_REWARDS_PER_SEC, "too high");
        require(block.timestamp < _startTime, "MasterChef: late");
        require(
            _feeAddress != address(0) &&
                _devAddress != address(0) &&
                address(_rewardToken) != address(0),
            "MasterChef: Zero address not allowed"
        );
        require(
            _devPercent <= 1000 && _feePercent <= 1000,
            "MasterChef: Invalid percentages"
        );
        rewardToken = _rewardToken;
        feeAddress = _feeAddress;
        devAddress = _devAddress;
        feePercent = _feePercent;
        devPercent = _devPercent;
        rewardsPerSec = _rewardsPerSec;
        startTime = _startTime;
    }

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

    // Add a new lp to the pool
    function add(
        uint256 _allocPoint,
        IERC20 _token,
        bool _withUpdate,
        uint256 _lastRewardTime,
        uint16 _depositFeeBP,
        uint16 _withdrawFeeBP
    ) external onlyOwner {
        IPair pool_lp = IPair(address(_token));
        IERC20 token0 = IERC20(pool_lp.token0());
        IERC20 token1 = IERC20(pool_lp.token1());
        
        require(
            address(token0) != address(0) && address(token1) != address(0),
            "MasterChef: Only LP tokens "
        );
        require(
            Address.isContract(address(_token)),
            "MasterChef: LP token must be a valid contract"
        );

        require(
            _depositFeeBP <= 400 && _withdrawFeeBP <= 400,
            "MasterChef: Invalid deposit or withdraw fee basis points"
        );
        require(
            !lpTokens.contains(address(_token)),
            "MasterChef: LP already added"
        );

        if (_withUpdate) {
            massUpdatePools();
        }

        if (block.timestamp < startTime) {
            // chef is sleeping
            if (_lastRewardTime < startTime) {
                _lastRewardTime = startTime;
            }
        } else {
            // chef is cooking
            if (_lastRewardTime < block.timestamp) {
                _lastRewardTime = block.timestamp;
            }
        }
        bool _isStarted = (block.timestamp >= startTime) &&
            (block.timestamp >= _lastRewardTime);
        poolInfo.push(
            PoolInfo({
                token: _token,
                allocPoint: _allocPoint,
                lastRewardTime: _lastRewardTime,
                accTokensPerShare: 0,
                isStarted: _isStarted,
                depositFeeBP: _depositFeeBP,
                withdrawFeeBP: _withdrawFeeBP,
                lpBalance: 0
            })
        );
        if (_isStarted) {
            totalAllocPoint = totalAllocPoint.add(_allocPoint);
        }

        lpTokens.add(address(_token));
    }

    // Update the given pool's allocation point. Can only be called by the owner.
    function set(
        uint256 _pid,
        uint256 _allocPoint,
        uint16 _depositFeeBP,
        uint16 _withdrawFeeBP
    ) external onlyOwner {
        require(
            _depositFeeBP <= 400 && _withdrawFeeBP <= 400,
            "MasterChef: Invalid deposit or withdraw fee basis points"
        );
        massUpdatePools();
        PoolInfo storage pool = poolInfo[_pid];
        if (pool.isStarted) {
            totalAllocPoint = totalAllocPoint.sub(pool.allocPoint).add(
                _allocPoint
            );
        }
        pool.allocPoint = _allocPoint;
        poolInfo[_pid].depositFeeBP = _depositFeeBP;
        poolInfo[_pid].withdrawFeeBP = _withdrawFeeBP;
    }

    // Return accumulate rewards over the given _from to _to block.
    function getMultiplier(
        uint256 _from,
        uint256 _to
    ) public view returns (uint256) {
        if (_from >= _to) return 0;
        if (_to <= startTime) return 0;
        if (_from >= startTime) {
            return _to.sub(_from);
        } else {
            return _to.sub(startTime);
        }
    }

    // View function to see pending rewards on frontend.
    function pendingShare(
        uint256 _pid,
        address _user
    ) public view returns (uint256) {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][_user];
        uint256 accTokensPerShare = pool.accTokensPerShare;
        uint256 tokenSupply = pool.lpBalance;
        if (block.timestamp > pool.lastRewardTime && tokenSupply != 0) {
            uint256 multiplier = getMultiplier(
                pool.lastRewardTime,
                block.timestamp
            );
            uint256 lpPercent = 10000 - devPercent - feePercent;
            uint256 _generatedReward = multiplier.mul(rewardsPerSec);
            uint256 _rewards = _generatedReward
                .mul(pool.allocPoint)
                .div(totalAllocPoint)
                .mul(lpPercent)
                .div(10000);
            accTokensPerShare = accTokensPerShare.add(
                _rewards.mul(1e18).div(tokenSupply)
            );
        }
        return
            user.amount.mul(accTokensPerShare).div(1e18).sub(user.rewardDebt);
    }

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

    // Update reward variables of the given pool to be up-to-date.
    function updatePool(uint256 _pid) public {
        PoolInfo storage pool = poolInfo[_pid];
        if (block.timestamp <= pool.lastRewardTime) {
            return;
        }
        if (!pool.isStarted) {
            pool.isStarted = true;
            totalAllocPoint = totalAllocPoint.add(pool.allocPoint);
        }
        uint256 tokenSupply = pool.lpBalance;
        if (tokenSupply == 0) {
            pool.lastRewardTime = block.timestamp;
            return;
        }

        if (totalAllocPoint > 0) {
            uint256 multiplier = getMultiplier(
                pool.lastRewardTime,
                block.timestamp
            );
            uint256 _generatedReward = multiplier.mul(rewardsPerSec);
            uint256 _rewards = _generatedReward
                .mul(pool.allocPoint)
                .div(totalAllocPoint);
            uint256 lpPercent = 10000 - devPercent - feePercent;
            rewardToken.mintFor(
                devAddress,
                _rewards.mul(devPercent).div(10000)
            );
            rewardToken.mintFor(
                feeAddress,
                _rewards.mul(feePercent).div(10000)
            );
            rewardToken.mintFor(
                address(this),
                _rewards.mul(lpPercent).div(10000) + _rewards.mul(referralRate).div(10000)
            );

            pool.accTokensPerShare = pool.accTokensPerShare.add(
                _rewards.mul(1e18).div(tokenSupply).mul(lpPercent).div(
                    10000
                )
            );
        }
        pool.lastRewardTime = block.timestamp;
    }

    function deposit(
        uint256 _pid,
        uint256 _amount,
        address _referrer
    ) external nonReentrant {
        address staker = _msgSender();
        _deposit(_pid, _amount, _referrer, staker);
    }

    function depositOnBehalfOf(
        uint256 _pid,
        uint256 _amount,
        address _referrer,
        address _staker
    ) external nonReentrant {
        _deposit(_pid, _amount, _referrer, _staker);
    }

    function withdraw(uint256 _pid, uint256 _amount) external nonReentrant {
        _withdraw(_pid, _amount);
    }

    function _deposit(
        uint256 _pid,
        uint256 _amount,
        address _referrer,
        address _staker
    ) private {
        if (referral[_staker] == address(0)) {
        require(
            _referrer != address(0) &&
                _referrer != _staker &&
                _referrer != address(this),
            "MasterChef: Invalid referrer"
        );
            referral[_staker] = _referrer;
        } else {
            _referrer = referral[_staker];
        }

        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][_staker];
        updatePool(_pid);
        if (user.amount > 0) {
            uint256 _pending = user
                .amount
                .mul(pool.accTokensPerShare)
                .div(1e18)
                .sub(user.rewardDebt);
            if (_pending > 0) {
                uint256 referralAmount = ((_pending) * referralRate) / 10000;
                if (referralAmount > 0) {
                    referralEarned[_referrer] =
                        referralEarned[_referrer] +
                        referralAmount;
                    safeRewardTransfer(_referrer, referralAmount);
                }
                safeRewardTransfer(_staker, _pending);
                emit RewardPaid(_staker, _pending);
            }
        }
        if (_amount > 0) {
            pool.token.safeTransferFrom(_msgSender(), address(this), _amount);
        }

        if (pool.depositFeeBP > 0) {
            uint256 depositFee = _amount.mul(pool.depositFeeBP).div(10000);
            pool.token.safeTransfer(feeAddress, depositFee);
            user.amount = user.amount.add(_amount).sub(depositFee);
            pool.lpBalance = pool.lpBalance.add(_amount).sub(depositFee);
        } else {
            user.amount = user.amount.add(_amount);
            pool.lpBalance = pool.lpBalance.add(_amount);
        }

        user.rewardDebt = user.amount.mul(pool.accTokensPerShare).div(1e18);
        emit Deposit(_staker, _pid, _amount);
    }

    function _withdraw(uint256 _pid, uint256 _amount) private {
        address _sender = _msgSender();
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][_sender];
        require(
            user.amount >= _amount,
            "MasterChef: User amount too low"
        );
        updatePool(_pid);
        address referrer = referral[_sender];
        uint256 _pending = user
            .amount
            .mul(pool.accTokensPerShare)
            .div(1e18)
            .sub(user.rewardDebt);

        if (_pending > 0) {
            uint256 referralAmount = ((_pending) * referralRate) / 10000;
            if (referralAmount > 0) {
                referralEarned[referrer] =
                    referralEarned[referrer] +
                    referralAmount;
                safeRewardTransfer(referrer, referralAmount);
            }

            safeRewardTransfer(_sender, _pending);
            emit RewardPaid(_sender, _pending);
        }
        if (_amount > 0) {
            user.amount = user.amount.sub(_amount);
            if (pool.withdrawFeeBP > 0) {
                uint256 withdrawFee = _amount.mul(pool.withdrawFeeBP).div(
                    10000
                );
                pool.token.safeTransfer(feeAddress, withdrawFee);
                pool.token.safeTransfer(_sender, _amount.sub(withdrawFee));
            } else {
                pool.token.safeTransfer(_sender, _amount);
            }
        }
        user.rewardDebt = user.amount.mul(pool.accTokensPerShare).div(1e18);
        pool.lpBalance -= _amount;
        emit Withdraw(_sender, _pid, _amount);
    }

    // Withdraw without caring about rewards. EMERGENCY ONLY.
    function emergencyWithdraw(uint256 _pid) public nonReentrant {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][_msgSender()];
        uint256 _amount = user.amount;
        require(_amount > 0, "MasterChef: User has no amount");
        user.amount = 0;
        user.rewardDebt = 0;
        if (pool.withdrawFeeBP > 0) {
            uint256 withdrawFee = _amount.mul(pool.withdrawFeeBP).div(10000);
            pool.token.safeTransfer(feeAddress, withdrawFee);
            pool.token.safeTransfer(_msgSender(), _amount.sub(withdrawFee));
        } else {
            pool.token.safeTransfer(_msgSender(), _amount);
        }
        pool.lpBalance -= _amount;
        emit EmergencyWithdraw(_msgSender(), _pid, _amount);
    }

    // Safe rewardToken transfer function, just in case if rounding error causes pool to not have enough rewardToken.
    function safeRewardTransfer(address _to, uint256 _amount) internal {
        uint256 _emitBalance = rewardToken.balanceOf(address(this));
        if (_emitBalance > 0) {
            if (_amount > _emitBalance) {
                rewardToken.safeTransfer(_to, _emitBalance);
            } else {
                rewardToken.safeTransfer(_to, _amount);
            }
        }
    }

    function setFeeAddress(address _feeAddress) external onlyOwner {
        require(
            _feeAddress != address(0),
            "MasterChef: Zero address not allowed"
        );
        feeAddress = _feeAddress;
    }

    function setFeePercent(uint256 _feePercent) external onlyOwner {
        require(
            _feePercent <= 1000,
            "MasterChef: invalid fee"
        );
        feePercent = _feePercent;
    }

    function setDevAddress(address _devAddress) external onlyOwner {
        require(
            _devAddress != address(0),
            "MasterChef: Invalid percentages"
        );
        devAddress = _devAddress;
    }

    function setDevPercent(uint256 _devPercent) external onlyOwner {
        require(
            _devPercent <= 1000,
            "MasterChef: Zero address not allowed"
        );
        devPercent = _devPercent;
    }

    function setReferralRate(uint256 _referralRate) external onlyOwner {
        require(_referralRate <= 500, "MasterChef: Too high");
        referralRate = _referralRate;
    }

    function updateEmissionRate(uint256 _rewardsPerSec) public onlyOwner {
        require(_rewardsPerSec <= MAX_REWARDS_PER_SEC, "too high");
        massUpdatePools();
        rewardsPerSec = _rewardsPerSec;
    }

    function getPoolView(uint256 pid) public view returns (PoolView memory) {
        require(pid < poolInfo.length, "MasterChef: pid out of range");
        PoolInfo memory pool = poolInfo[pid];
        uint256 lpPercent = 10000 - devPercent - feePercent;
        uint256 rewardsPerSecond;
        if(totalAllocPoint == 0){
        rewardsPerSecond = 0;
        }
        else {
        rewardsPerSecond = pool
            .allocPoint
            .mul(rewardsPerSec)
            .div(totalAllocPoint)
            .mul(lpPercent)
            .div(10000);
        }
        return
            PoolView({
                pid: pid,
                token: address(pool.token),
                allocPoint: pool.allocPoint,
                lastRewardTime: pool.lastRewardTime,
                depositFeeBP: pool.depositFeeBP,
                withdrawFeeBP: pool.withdrawFeeBP,
                accTokensPerShare: pool.accTokensPerShare,
                isStarted: pool.isStarted,
                lpBalance: pool.lpBalance,
                rewardsPerSecond: rewardsPerSecond
            });
    }

    function getAllPoolViews() external view returns (PoolView[] memory) {
        PoolView[] memory views = new PoolView[](poolInfo.length);
        for (uint256 i = 0; i < poolInfo.length; i++) {
            views[i] = getPoolView(i);
        }
        return views;
    }

    function getUserView(
        uint256 pid,
        address account
    ) public view returns (UserView memory) {
        PoolInfo memory pool = poolInfo[pid];
        UserInfo memory user = userInfo[pid][account];
        uint256 unclaimedRewards = pendingShare(pid, account);
        uint256 lpBalance = pool.token.balanceOf(account);
        return
            UserView({
                pid: pid,
                stakedAmount: user.amount,
                unclaimedRewards: unclaimedRewards,
                lpBalance: lpBalance,
                allowance: pool.token.allowance(account, address(this))
            });
    }

    function getUserViews(
        address account
    ) external view returns (UserView[] memory) {
        UserView[] memory views = new UserView[](poolInfo.length);
        for (uint256 i = 0; i < poolInfo.length; i++) {
            views[i] = getUserView(i, account);
        }
        return views;
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

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

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

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

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

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     *
     * CAUTION: See Security Considerations above.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    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));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    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");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

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

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

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // 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 cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return
            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
    }
}

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

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);
}

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

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

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 12 of 15 : Multicall.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.5) (utils/Multicall.sol)

pragma solidity ^0.8.0;

import "./Address.sol";
import "./Context.sol";

/**
 * @dev Provides a function to batch together multiple calls in a single external call.
 *
 * Consider any assumption about calldata validation performed by the sender may be violated if it's not especially
 * careful about sending transactions invoking {multicall}. For example, a relay address that filters function
 * selectors won't filter calls nested within a {multicall} operation.
 *
 * NOTE: Since 5.0.1 and 4.9.4, this contract identifies non-canonical contexts (i.e. `msg.sender` is not {_msgSender}).
 * If a non-canonical context is identified, the following self `delegatecall` appends the last bytes of `msg.data`
 * to the subcall. This makes it safe to use with {ERC2771Context}. Contexts that don't affect the resolution of
 * {_msgSender} are not propagated to subcalls.
 *
 * _Available since v4.1._
 */
abstract contract Multicall is Context {
    /**
     * @dev Receives and executes a batch of function calls on this contract.
     * @custom:oz-upgrades-unsafe-allow-reachable delegatecall
     */
    function multicall(bytes[] calldata data) external virtual returns (bytes[] memory results) {
        bytes memory context = msg.sender == _msgSender()
            ? new bytes(0)
            : msg.data[msg.data.length - _contextSuffixLength():];

        results = new bytes[](data.length);
        for (uint256 i = 0; i < data.length; i++) {
            results[i] = Address.functionDelegateCall(address(this), bytes.concat(data[i], context));
        }
        return results;
    }
}

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

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```solidity
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 *
 * [WARNING]
 * ====
 * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
 * unusable.
 * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
 * array of EnumerableSet.
 * ====
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

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

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

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

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

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

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

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

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

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

            return true;
        } else {
            return false;
        }
    }

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

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

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

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

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

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

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

        return result;
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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

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

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

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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

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

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

        return result;
    }
}

// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity 0.8.20;

interface IPair {
    error NOT_AUTHORIZED();
    error UNSTABLE_RATIO();
    /// @dev safe transfer failed
    error STF();
    error OVERFLOW();
    /// @dev skim disabled
    error SD();
    /// @dev insufficient liquidity minted
    error ILM();
    /// @dev insufficient liquidity burned
    error ILB();
    /// @dev insufficient output amount
    error IOA();
    /// @dev insufficient input amount
    error IIA();
    error IL();
    error IT();
    error K();

    event Mint(address indexed sender, uint256 amount0, uint256 amount1);
    event Burn(
        address indexed sender,
        uint256 amount0,
        uint256 amount1,
        address indexed to
    );
    event Swap(
        address indexed sender,
        uint256 amount0In,
        uint256 amount1In,
        uint256 amount0Out,
        uint256 amount1Out,
        address indexed to
    );
    event Sync(uint112 reserve0, uint112 reserve1);

    /// @notice initialize the pool, called only once programatically
    function initialize(
        address _token0,
        address _token1,
        bool _stable
    ) external;

    /// @notice calculate the current reserves of the pool and their last 'seen' timestamp
    /// @return _reserve0 amount of token0 in reserves
    /// @return _reserve1 amount of token1 in reserves
    /// @return _blockTimestampLast the timestamp when the pool was last updated
    function getReserves()
        external
        view
        returns (
            uint112 _reserve0,
            uint112 _reserve1,
            uint32 _blockTimestampLast
        );

    /// @notice mint the pair tokens (LPs)
    /// @param to where to mint the LP tokens to
    /// @return liquidity amount of LP tokens to mint
    function mint(address to) external returns (uint256 liquidity);

    /// @notice burn the pair tokens (LPs)
    /// @param to where to send the underlying
    /// @return amount0 amount of amount0
    /// @return amount1 amount of amount1
    function burn(
        address to
    ) external returns (uint256 amount0, uint256 amount1);

    /// @notice direct swap through the pool
    function swap(
        uint256 amount0Out,
        uint256 amount1Out,
        address to,
        bytes calldata data
    ) external;

    /// @notice force balances to match reserves, can be used to harvest rebases from rebasing tokens or other external factors
    /// @param to where to send the excess tokens to
    function skim(address to) external;

    /// @notice force reserves to match balances, prevents skim excess if skim is enabled
    function sync() external;

    /// @notice set the pair fees contract address
    function setFeeRecipient(address _pairFees) external;

    /// @notice set the feesplit variable
    function setFeeSplit(uint256 _feeSplit) external;

    /// @notice sets the swap fee of the pair
    /// @dev max of 10_000 (10%)
    /// @param _fee the fee
    function setFee(uint256 _fee) external;

    /// @notice 'mint' the fees as LP tokens
    /// @dev this is used for protocol/voter fees
    function mintFee() external;

    /// @notice calculates the amount of tokens to receive post swap
    /// @param amountIn the token amount
    /// @param tokenIn the address of the token
    function getAmountOut(
        uint256 amountIn,
        address tokenIn
    ) external view returns (uint256 amountOut);

    /// @notice returns various metadata about the pair
    function metadata()
        external
        view
        returns (
            uint256 _decimals0,
            uint256 _decimals1,
            uint256 _reserve0,
            uint256 _reserve1,
            bool _stable,
            address _token0,
            address _token1
        );

    /// @notice returns the feeSplit of the pair
    function feeSplit() external view returns (uint256);

    /// @notice returns the fee of the pair
    function fee() external view returns (uint256);

    /// @notice returns the feeRecipient of the pair
    function feeRecipient() external view returns (address);
    function token0() external view returns (address);
    function token1() external view returns (address);
}

// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;

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

interface IRewardToken is IERC20 {
    function mintFor(address _address, uint256 _amount) external returns (bool);
    function safeTokenTransfer(address _to, uint256 _amount) external;
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"contract IRewardToken","name":"_rewardToken","type":"address"},{"internalType":"address","name":"_feeAddress","type":"address"},{"internalType":"address","name":"_devAddress","type":"address"},{"internalType":"uint256","name":"_feePercent","type":"uint256"},{"internalType":"uint256","name":"_devPercent","type":"uint256"},{"internalType":"uint256","name":"_rewardsPerSec","type":"uint256"},{"internalType":"uint256","name":"_startTime","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EmergencyWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RewardPaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"MAX_REWARDS_PER_SEC","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_allocPoint","type":"uint256"},{"internalType":"contract IERC20","name":"_token","type":"address"},{"internalType":"bool","name":"_withUpdate","type":"bool"},{"internalType":"uint256","name":"_lastRewardTime","type":"uint256"},{"internalType":"uint16","name":"_depositFeeBP","type":"uint16"},{"internalType":"uint16","name":"_withdrawFeeBP","type":"uint16"}],"name":"add","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_referrer","type":"address"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_referrer","type":"address"},{"internalType":"address","name":"_staker","type":"address"}],"name":"depositOnBehalfOf","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"devAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"devPercent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feeAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feePercent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllPoolViews","outputs":[{"components":[{"internalType":"uint256","name":"pid","type":"uint256"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"allocPoint","type":"uint256"},{"internalType":"uint256","name":"lastRewardTime","type":"uint256"},{"internalType":"uint16","name":"depositFeeBP","type":"uint16"},{"internalType":"uint16","name":"withdrawFeeBP","type":"uint16"},{"internalType":"uint256","name":"accTokensPerShare","type":"uint256"},{"internalType":"bool","name":"isStarted","type":"bool"},{"internalType":"uint256","name":"lpBalance","type":"uint256"},{"internalType":"uint256","name":"rewardsPerSecond","type":"uint256"}],"internalType":"struct MasterChef.PoolView[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_from","type":"uint256"},{"internalType":"uint256","name":"_to","type":"uint256"}],"name":"getMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid","type":"uint256"}],"name":"getPoolView","outputs":[{"components":[{"internalType":"uint256","name":"pid","type":"uint256"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"allocPoint","type":"uint256"},{"internalType":"uint256","name":"lastRewardTime","type":"uint256"},{"internalType":"uint16","name":"depositFeeBP","type":"uint16"},{"internalType":"uint16","name":"withdrawFeeBP","type":"uint16"},{"internalType":"uint256","name":"accTokensPerShare","type":"uint256"},{"internalType":"bool","name":"isStarted","type":"bool"},{"internalType":"uint256","name":"lpBalance","type":"uint256"},{"internalType":"uint256","name":"rewardsPerSecond","type":"uint256"}],"internalType":"struct MasterChef.PoolView","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid","type":"uint256"},{"internalType":"address","name":"account","type":"address"}],"name":"getUserView","outputs":[{"components":[{"internalType":"uint256","name":"pid","type":"uint256"},{"internalType":"uint256","name":"stakedAmount","type":"uint256"},{"internalType":"uint256","name":"unclaimedRewards","type":"uint256"},{"internalType":"uint256","name":"lpBalance","type":"uint256"},{"internalType":"uint256","name":"allowance","type":"uint256"}],"internalType":"struct MasterChef.UserView","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getUserViews","outputs":[{"components":[{"internalType":"uint256","name":"pid","type":"uint256"},{"internalType":"uint256","name":"stakedAmount","type":"uint256"},{"internalType":"uint256","name":"unclaimedRewards","type":"uint256"},{"internalType":"uint256","name":"lpBalance","type":"uint256"},{"internalType":"uint256","name":"allowance","type":"uint256"}],"internalType":"struct MasterChef.UserView[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"massUpdatePools","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"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":"pendingShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolInfo","outputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"uint256","name":"allocPoint","type":"uint256"},{"internalType":"uint256","name":"lastRewardTime","type":"uint256"},{"internalType":"uint16","name":"depositFeeBP","type":"uint16"},{"internalType":"uint16","name":"withdrawFeeBP","type":"uint16"},{"internalType":"uint256","name":"accTokensPerShare","type":"uint256"},{"internalType":"bool","name":"isStarted","type":"bool"},{"internalType":"uint256","name":"lpBalance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"referral","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"referralEarned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"referralRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"contract IRewardToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardsPerSec","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_allocPoint","type":"uint256"},{"internalType":"uint16","name":"_depositFeeBP","type":"uint16"},{"internalType":"uint16","name":"_withdrawFeeBP","type":"uint16"}],"name":"set","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_devAddress","type":"address"}],"name":"setDevAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_devPercent","type":"uint256"}],"name":"setDevPercent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_feeAddress","type":"address"}],"name":"setFeeAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_feePercent","type":"uint256"}],"name":"setFeePercent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_referralRate","type":"uint256"}],"name":"setReferralRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAllocPoint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rewardsPerSec","type":"uint256"}],"name":"updateEmissionRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"updatePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"userInfo","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"rewardDebt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405260006007556101f4600e553480156200001c57600080fd5b5060405162003314380380620033148339810160408190526200003f9162000291565b60016000556200004f3362000226565b68015af1d78b58c40000821115620000995760405162461bcd60e51b81526020600482015260086024820152670e8dede40d0d2ced60c31b60448201526064015b60405180910390fd5b804210620000dd5760405162461bcd60e51b815260206004820152601060248201526f4d6173746572436865663a206c61746560801b604482015260640162000090565b6001600160a01b03861615801590620000fe57506001600160a01b03851615155b80156200011357506001600160a01b03871615155b6200016d5760405162461bcd60e51b8152602060048201526024808201527f4d6173746572436865663a205a65726f2061646472657373206e6f7420616c6c6044820152631bddd95960e21b606482015260840162000090565b6103e883111580156200018257506103e88411155b620001d05760405162461bcd60e51b815260206004820152601f60248201527f4d6173746572436865663a20496e76616c69642070657263656e746167657300604482015260640162000090565b600280546001600160a01b03199081166001600160a01b03998a161790915560098054821697891697909717909655600a80549096169490961693909317909355600b55600c91909155600d556008556200030c565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b03811681146200028e57600080fd5b50565b600080600080600080600060e0888a031215620002ad57600080fd5b8751620002ba8162000278565b6020890151909750620002cd8162000278565b6040890151909650620002e08162000278565b80955050606088015193506080880151925060a0880151915060c0880151905092959891949750929550565b612ff8806200031c6000396000f3fe608060405234801561001057600080fd5b506004361061023c5760003560e01c80637247959a1161013b578063a053ce1f116100b8578063d0c9bb591161007c578063d0c9bb5914610568578063d0d41fe114610588578063f2fde38b1461059b578063f7c618c1146105ae578063fc3c28af146105c157600080fd5b8063a053ce1f14610509578063a2822cef14610512578063ac9650d814610522578063ca4863fd14610542578063cf4b55cb1461055557600080fd5b80638da5cb5b116100ff5780638da5cb5b1461046b5780638dbb1e3a1461047c5780638dbdbe6d1461048f578063900ea587146104a257806393f1a40b146104c257600080fd5b80637247959a1461040a57806378e97925146104335780637ce3489b1461043c5780637fd6f15c1461044f5780638705fcd41461045857600080fd5b80633ad10ef6116101c95780635312ea8e1161018d5780635312ea8e146103bf578063630b5ba1146103d257806364757332146103da5780636eaddad2146103ef578063715018a61461040257600080fd5b80633ad10ef6146103485780634127535814610373578063441a3e7014610386578063457b34371461039957806351eb05a6146103ac57600080fd5b80631526fe27116102105780631526fe271461028d57806317caf6f1146102ec5780632111ff51146102f5578063225b87c41461030857806331cd61791461032857600080fd5b806289345214610241578063081e3eda1461025d5780630ba84cd2146102655780630d3365911461027a575b600080fd5b61024a600d5481565b6040519081526020015b60405180910390f35b60035461024a565b610278610273366004612895565b6105ca565b005b6102786102883660046128c3565b610628565b6102a061029b366004612895565b61064c565b604080516001600160a01b03909916895260208901979097529587019490945261ffff92831660608701529116608085015260a0840152151560c083015260e082015261010001610254565b61024a60075481565b610278610303366004612932565b6106b5565b61031b61031636600461299c565b610b2b565b60405161025491906129b9565b61024a61033636600461299c565b60106020526000908152604090205481565b600a5461035b906001600160a01b031681565b6040516001600160a01b039091168152602001610254565b60095461035b906001600160a01b031681565b610278610394366004612a32565b610c00565b6102786103a7366004612a54565b610c20565b6102786103ba366004612895565b610d52565b6102786103cd366004612895565b61108c565b610278611238565b6103e261125f565b6040516102549190612b2e565b6102786103fd366004612895565b611308565b610278611337565b61035b61041836600461299c565b600f602052600090815260409020546001600160a01b031681565b61024a60085481565b61027861044a366004612895565b61134b565b61024a600b5481565b61027861046636600461299c565b6113aa565b6001546001600160a01b031661035b565b61024a61048a366004612a32565b6113fa565b61027861049d366004612b71565b61144a565b6104b56104b0366004612baa565b61146f565b6040516102549190612bda565b6104f46104d0366004612baa565b60066020908152600092835260408084209091529082529020805460019091015482565b60408051928352602083019190915201610254565b61024a600e5481565b61024a68015af1d78b58c4000081565b610535610530366004612c13565b611687565b6040516102549190612cd8565b610278610550366004612895565b61177a565b61024a610563366004612baa565b6117d0565b61057b610576366004612895565b611918565b6040516102549190612d3a565b61027861059636600461299c565b611ae9565b6102786105a936600461299c565b611b69565b60025461035b906001600160a01b031681565b61024a600c5481565b6105d2611bdf565b68015af1d78b58c4000081111561061b5760405162461bcd60e51b81526020600482015260086024820152670e8dede40d0d2ced60c31b60448201526064015b60405180910390fd5b610623611238565b600d55565b610630611c39565b61063c84848484611c92565b6106466001600055565b50505050565b6003818154811061065c57600080fd5b600091825260209091206007909102018054600182015460028301546003840154600485015460058601546006909601546001600160a01b0390951696509294919361ffff8083169462010000909304169260ff169088565b6106bd611bdf565b60008590506000816001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015610702573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107269190612d49565b90506000826001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610768573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061078c9190612d49565b90506001600160a01b038216158015906107ae57506001600160a01b03811615155b6107fa5760405162461bcd60e51b815260206004820152601b60248201527f4d6173746572436865663a204f6e6c79204c5020746f6b656e732000000000006044820152606401610612565b6001600160a01b0388163b6108675760405162461bcd60e51b815260206004820152602d60248201527f4d6173746572436865663a204c5020746f6b656e206d7573742062652061207660448201526c185b1a590818dbdb9d1c9858dd609a1b6064820152608401610612565b6101908561ffff161115801561088357506101908461ffff1611155b61089f5760405162461bcd60e51b815260040161061290612d66565b6108aa600489612004565b156108f75760405162461bcd60e51b815260206004820152601c60248201527f4d6173746572436865663a204c5020616c7265616479206164646564000000006044820152606401610612565b861561090557610905611238565b6008544210156109245760085486101561091f5760085495505b610930565b42861015610930574295505b600060085442101580156109445750864210155b60408051610100810182526001600160a01b03808d168252602082018e81529282018b815261ffff808c16606085019081528b821660808601908152600060a087018181528915801560c08a0190815260e08a01848152600380546001810182559552995160079094027fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b8101805495909a166001600160a01b03199095169490941790985598517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85c83015594517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85d82015591517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85e8301805492518516620100000263ffffffff1990931691909416171790915590517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85f82015590517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f8608201805491151560ff1990921691909117905590517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f86190910155909150610b1357600754610b0f908b612029565b6007555b610b1e60048a612035565b5050505050505050505050565b60035460609060009067ffffffffffffffff811115610b4c57610b4c612dc3565b604051908082528060200260200182016040528015610baf57816020015b610b9c6040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b815260200190600190039081610b6a5790505b50905060005b600354811015610bf957610bc9818561146f565b828281518110610bdb57610bdb612dd9565b60200260200101819052508080610bf190612e05565b915050610bb5565b5092915050565b610c08611c39565b610c12828261204a565b610c1c6001600055565b5050565b610c28611bdf565b6101908261ffff1611158015610c4457506101908161ffff1611155b610c605760405162461bcd60e51b815260040161061290612d66565b610c68611238565b600060038581548110610c7d57610c7d612dd9565b60009182526020909120600790910201600581015490915060ff1615610cc457610cc084610cba836001015460075461232890919063ffffffff16565b90612029565b6007555b8381600101819055508260038681548110610ce157610ce1612dd9565b906000526020600020906007020160030160006101000a81548161ffff021916908361ffff1602179055508160038681548110610d2057610d20612dd9565b906000526020600020906007020160030160026101000a81548161ffff021916908361ffff1602179055505050505050565b600060038281548110610d6757610d67612dd9565b9060005260206000209060070201905080600201544211610d86575050565b600581015460ff16610db75760058101805460ff19166001908117909155810154600754610db391612029565b6007555b60068101546000819003610dd057504260029091015550565b60075415611081576000610de88360020154426113fa565b90506000610e01600d548361233490919063ffffffff16565b90506000610e28600754610e2287600101548561233490919063ffffffff16565b90612340565b90506000600b54600c54612710610e3f9190612e1e565b610e499190612e1e565b600254600a54600c549293506001600160a01b039182169263da1919b39290911690610e7e9061271090610e22908890612334565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015610ec9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eed9190612e31565b50600254600954600b546001600160a01b039283169263da1919b3921690610f1e9061271090610e22908890612334565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015610f69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f8d9190612e31565b50600254600e546001600160a01b039091169063da1919b3903090610fbb9061271090610e22908890612334565b610fcb612710610e228888612334565b610fd59190612e4e565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015611020573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110449190612e31565b5061107761106c612710610e22846110668a8389670de0b6b3a7640000612334565b90612334565b600488015490612029565b6004870155505050505b504260029091015550565b611094611c39565b6000600382815481106110a9576110a9612dd9565b600091825260208083208584526006909152604083206007909202019250816110cf3390565b6001600160a01b03168152602081019190915260400160002080549091508061113a5760405162461bcd60e51b815260206004820152601e60248201527f4d6173746572436865663a205573657220686173206e6f20616d6f756e7400006044820152606401610612565b60008083556001830155600383015462010000900461ffff16156111c257600383015460009061117d9061271090610e2290859062010000900461ffff16612334565b600954855491925061119c916001600160a01b0390811691168361234c565b6111bc336111aa8484612328565b86546001600160a01b0316919061234c565b506111d8565b6111d83384546001600160a01b0316908361234c565b808360060160008282546111ec9190612e1e565b9091555050604051818152849033907fbb757047c2b5f3974fe26b7c10f732e7bce710b0952a71082702781e62ae05959060200160405180910390a35050506112356001600055565b50565b60035460005b81811015610c1c5761124f81610d52565b61125881612e05565b905061123e565b60035460609060009067ffffffffffffffff81111561128057611280612dc3565b6040519080825280602002602001820160405280156112b957816020015b6112a661282f565b81526020019060019003908161129e5790505b50905060005b600354811015611302576112d281611918565b8282815181106112e4576112e4612dd9565b602002602001018190525080806112fa90612e05565b9150506112bf565b50919050565b611310611bdf565b6103e88111156113325760405162461bcd60e51b815260040161061290612e61565b600c55565b61133f611bdf565b61134960006123af565b565b611353611bdf565b6103e88111156113a55760405162461bcd60e51b815260206004820152601760248201527f4d6173746572436865663a20696e76616c6964206665650000000000000000006044820152606401610612565b600b55565b6113b2611bdf565b6001600160a01b0381166113d85760405162461bcd60e51b815260040161061290612e61565b600980546001600160a01b0319166001600160a01b0392909216919091179055565b600081831061140b57506000611444565b600854821161141c57506000611444565b60085483106114365761142f8284612328565b9050611444565b60085461142f908390612328565b92915050565b611452611c39565b3361145f84848484611c92565b5061146a6001600055565b505050565b6114a16040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b6000600384815481106114b6576114b6612dd9565b600091825260208083206040805161010081018252600790940290910180546001600160a01b03908116855260018083015486860152600283015486850152600383015461ffff808216606089015262010000909104166080870152600483015460a0870152600583015460ff16151560c087015260069283015460e08701528a8752918452828620908916865283528185208251808401909352805483520154918101919091529092509061156c86866117d0565b83516040516370a0823160e01b81526001600160a01b038881166004830152929350600092909116906370a0823190602401602060405180830381865afa1580156115bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115df9190612ea5565b6040805160a081018252898152855160208201528082018590526060810183905286519151636eb1769f60e11b81526001600160a01b038a8116600483015230602483015293945090926080840192169063dd62ed3e90604401602060405180830381865afa158015611656573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061167a9190612ea5565b9052979650505050505050565b6040805160008152602081019091526060908267ffffffffffffffff8111156116b2576116b2612dc3565b6040519080825280602002602001820160405280156116e557816020015b60608152602001906001900390816116d05790505b50915060005b83811015611772576117423086868481811061170957611709612dd9565b905060200281019061171b9190612ebe565b8560405160200161172e93929190612f0c565b604051602081830303815290604052612401565b83828151811061175457611754612dd9565b6020026020010181905250808061176a90612e05565b9150506116eb565b505092915050565b611782611bdf565b6101f48111156117cb5760405162461bcd60e51b815260206004820152601460248201527309ac2e6e8cae486d0cacc7440a8dede40d0d2ced60631b6044820152606401610612565b600e55565b600080600384815481106117e6576117e6612dd9565b60009182526020808320878452600680835260408086206001600160a01b038a16875290935291909320600460079093029093019182015490820154600283015492945090914211801561183957508015155b156118dc57600061184e8560020154426113fa565b90506000600b54600c546127106118659190612e1e565b61186f9190612e1e565b90506000611888600d548461233490919063ffffffff16565b905060006118b3612710610e2285611066600754610e228e600101548961233490919063ffffffff16565b90506118d56118ce86610e2284670de0b6b3a7640000612334565b8790612029565b9550505050505b61190d8360010154611907670de0b6b3a7640000610e2286886000015461233490919063ffffffff16565b90612328565b979650505050505050565b61192061282f565b60035482106119715760405162461bcd60e51b815260206004820152601c60248201527f4d6173746572436865663a20706964206f7574206f662072616e6765000000006044820152606401610612565b60006003838154811061198657611986612dd9565b600091825260208083206040805161010081018252600790940290910180546001600160a01b03168452600181015492840192909252600282015490830152600381015461ffff808216606085015262010000909104166080830152600481015460a0830152600581015460ff16151560c08301526006015460e0820152600b54600c5491935090611a1a90612710612e1e565b611a249190612e1e565b90506000600754600003611a3a57506000611a66565b611a63612710610e2284611066600754610e22600d548a6020015161233490919063ffffffff16565b90505b60405180610140016040528086815260200184600001516001600160a01b031681526020018460200151815260200184604001518152602001846060015161ffff168152602001846080015161ffff1681526020018460a0015181526020018460c00151151581526020018460e001518152602001828152509350505050919050565b611af1611bdf565b6001600160a01b038116611b475760405162461bcd60e51b815260206004820152601f60248201527f4d6173746572436865663a20496e76616c69642070657263656e7461676573006044820152606401610612565b600a80546001600160a01b0319166001600160a01b0392909216919091179055565b611b71611bdf565b6001600160a01b038116611bd65760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610612565b611235816123af565b6001546001600160a01b031633146113495760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610612565b600260005403611c8b5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610612565b6002600055565b6001600160a01b038181166000908152600f602052604090205416611d6f576001600160a01b03821615801590611cdb5750806001600160a01b0316826001600160a01b031614155b8015611cf057506001600160a01b0382163014155b611d3c5760405162461bcd60e51b815260206004820152601c60248201527f4d6173746572436865663a20496e76616c6964207265666572726572000000006044820152606401610612565b6001600160a01b038181166000908152600f6020526040902080546001600160a01b031916918416919091179055611d8d565b6001600160a01b038082166000908152600f60205260409020541691505b600060038581548110611da257611da2612dd9565b600091825260208083208884526006825260408085206001600160a01b0388168652909252922060079091029091019150611ddc86610d52565b805415611ed9576000611e148260010154611907670de0b6b3a7640000610e228760040154876000015461233490919063ffffffff16565b90508015611ed7576000612710600e5483611e2f9190612f33565b611e399190612f4a565b90508015611e88576001600160a01b038616600090815260106020526040902054611e65908290612e4e565b6001600160a01b038716600090815260106020526040902055611e888682612426565b611e928583612426565b846001600160a01b03167fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e048683604051611ecd91815260200190565b60405180910390a2505b505b8415611ef657611ef63383546001600160a01b03169030886124d1565b600382015461ffff1615611f76576003820154600090611f239061271090610e2290899061ffff16612334565b6009548454919250611f42916001600160a01b0390811691168361234c565b8154611f549082906119079089612029565b82556006830154611f6b9082906119079089612029565b600684015550611f99565b8054611f829086612029565b81556006820154611f939086612029565b60068301555b60048201548154611fb791670de0b6b3a764000091610e2291612334565b600182015560405185815286906001600160a01b038516907f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159060200160405180910390a3505050505050565b6001600160a01b038116600090815260018301602052604081205415155b9392505050565b60006120228284612e4e565b6000612022836001600160a01b038416612509565b600033905060006003848154811061206457612064612dd9565b600091825260208083208784526006825260408085206001600160a01b038816865290925292208054600790920290920192508411156120e65760405162461bcd60e51b815260206004820152601f60248201527f4d6173746572436865663a205573657220616d6f756e7420746f6f206c6f77006044820152606401610612565b6120ef85610d52565b6001600160a01b038084166000908152600f602052604081205460018401546004860154855492909416936121359261190791670de0b6b3a764000091610e2291612334565b905080156121f8576000612710600e54836121509190612f33565b61215a9190612f4a565b905080156121a9576001600160a01b038316600090815260106020526040902054612186908290612e4e565b6001600160a01b0384166000908152601060205260409020556121a98382612426565b6121b38683612426565b856001600160a01b03167fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e0486836040516121ee91815260200190565b60405180910390a2505b85156122a057825461220a9087612328565b8355600384015462010000900461ffff161561228a5760038401546000906122459061271090610e22908a9062010000900461ffff16612334565b6009548654919250612264916001600160a01b0390811691168361234c565b612284866122728984612328565b87546001600160a01b0316919061234c565b506122a0565b83546122a0906001600160a01b0316868861234c565b600484015483546122be91670de0b6b3a764000091610e2291612334565b8360010181905550858460060160008282546122da9190612e1e565b909155505060405186815287906001600160a01b038716907ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5689060200160405180910390a350505050505050565b60006120228284612e1e565b60006120228284612f33565b60006120228284612f4a565b6040516001600160a01b03831660248201526044810182905261146a90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612558565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60606120228383604051806060016040528060278152602001612f9c6027913961262d565b6002546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa15801561246f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124939190612ea5565b9050801561146a57808211156124ba5760025461146a906001600160a01b0316848361234c565b60025461146a906001600160a01b0316848461234c565b6040516001600160a01b03808516602483015283166044820152606481018290526106469085906323b872dd60e01b90608401612378565b600081815260018301602052604081205461255057508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155611444565b506000611444565b60006125ad826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166126a59092919063ffffffff16565b90508051600014806125ce5750808060200190518101906125ce9190612e31565b61146a5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610612565b6060600080856001600160a01b03168560405161264a9190612f6c565b600060405180830381855af49150503d8060008114612685576040519150601f19603f3d011682016040523d82523d6000602084013e61268a565b606091505b509150915061269b868383876126bc565b9695505050505050565b60606126b48484600085612735565b949350505050565b6060831561272b578251600003612724576001600160a01b0385163b6127245760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610612565b50816126b4565b6126b48383612805565b6060824710156127965760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610612565b600080866001600160a01b031685876040516127b29190612f6c565b60006040518083038185875af1925050503d80600081146127ef576040519150601f19603f3d011682016040523d82523d6000602084013e6127f4565b606091505b509150915061190d878383876126bc565b8151156128155781518083602001fd5b8060405162461bcd60e51b81526004016106129190612f88565b6040518061014001604052806000815260200160006001600160a01b031681526020016000815260200160008152602001600061ffff168152602001600061ffff1681526020016000815260200160001515815260200160008152602001600081525090565b6000602082840312156128a757600080fd5b5035919050565b6001600160a01b038116811461123557600080fd5b600080600080608085870312156128d957600080fd5b843593506020850135925060408501356128f2816128ae565b91506060850135612902816128ae565b939692955090935050565b801515811461123557600080fd5b803561ffff8116811461292d57600080fd5b919050565b60008060008060008060c0878903121561294b57600080fd5b86359550602087013561295d816128ae565b9450604087013561296d8161290d565b9350606087013592506129826080880161291b565b915061299060a0880161291b565b90509295509295509295565b6000602082840312156129ae57600080fd5b8135612022816128ae565b6020808252825182820181905260009190848201906040850190845b81811015612a2657612a1383855180518252602081015160208301526040810151604083015260608101516060830152608081015160808301525050565b9284019260a092909201916001016129d5565b50909695505050505050565b60008060408385031215612a4557600080fd5b50508035926020909101359150565b60008060008060808587031215612a6a57600080fd5b8435935060208501359250612a816040860161291b565b9150612a8f6060860161291b565b905092959194509250565b805182526020810151612ab860208401826001600160a01b03169052565b5060408101516040830152606081015160608301526080810151612ae2608084018261ffff169052565b5060a0810151612af860a084018261ffff169052565b5060c081015160c083015260e0810151612b1660e084018215159052565b50610100818101519083015261012090810151910152565b6020808252825182820181905260009190848201906040850190845b81811015612a2657612b5d838551612a9a565b928401926101409290920191600101612b4a565b600080600060608486031215612b8657600080fd5b83359250602084013591506040840135612b9f816128ae565b809150509250925092565b60008060408385031215612bbd57600080fd5b823591506020830135612bcf816128ae565b809150509250929050565b60a08101611444828480518252602081015160208301526040810151604083015260608101516060830152608081015160808301525050565b60008060208385031215612c2657600080fd5b823567ffffffffffffffff80821115612c3e57600080fd5b818501915085601f830112612c5257600080fd5b813581811115612c6157600080fd5b8660208260051b8501011115612c7657600080fd5b60209290920196919550909350505050565b60005b83811015612ca3578181015183820152602001612c8b565b50506000910152565b60008151808452612cc4816020860160208601612c88565b601f01601f19169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015612d2d57603f19888603018452612d1b858351612cac565b94509285019290850190600101612cff565b5092979650505050505050565b61014081016114448284612a9a565b600060208284031215612d5b57600080fd5b8151612022816128ae565b60208082526038908201527f4d6173746572436865663a20496e76616c6964206465706f736974206f72207760408201527f697468647261772066656520626173697320706f696e74730000000000000000606082015260800190565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201612e1757612e17612def565b5060010190565b8181038181111561144457611444612def565b600060208284031215612e4357600080fd5b81516120228161290d565b8082018082111561144457611444612def565b60208082526024908201527f4d6173746572436865663a205a65726f2061646472657373206e6f7420616c6c6040820152631bddd95960e21b606082015260800190565b600060208284031215612eb757600080fd5b5051919050565b6000808335601e19843603018112612ed557600080fd5b83018035915067ffffffffffffffff821115612ef057600080fd5b602001915036819003821315612f0557600080fd5b9250929050565b828482376000838201600081528351612f29818360208801612c88565b0195945050505050565b808202811582820484141761144457611444612def565b600082612f6757634e487b7160e01b600052601260045260246000fd5b500490565b60008251612f7e818460208701612c88565b9190910192915050565b6020815260006120226020830184612cac56fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b544478edf0b1f21d8df54091edb1a3e5d935726b7a6160e7369cddab6b352a664736f6c63430008140033000000000000000000000000c36cc0594106090bd13f3b4166a552994186a7fb0000000000000000000000001464be15b9956591135b336e35cdeae9297b08e50000000000000000000000001464be15b9956591135b336e35cdeae9297b08e500000000000000000000000000000000000000000000000000000000000001f400000000000000000000000000000000000000000000000000000000000001f400000000000000000000000000000000000000000000000000038d7ea4c680000000000000000000000000000000000000000000000000000000000068502759

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061023c5760003560e01c80637247959a1161013b578063a053ce1f116100b8578063d0c9bb591161007c578063d0c9bb5914610568578063d0d41fe114610588578063f2fde38b1461059b578063f7c618c1146105ae578063fc3c28af146105c157600080fd5b8063a053ce1f14610509578063a2822cef14610512578063ac9650d814610522578063ca4863fd14610542578063cf4b55cb1461055557600080fd5b80638da5cb5b116100ff5780638da5cb5b1461046b5780638dbb1e3a1461047c5780638dbdbe6d1461048f578063900ea587146104a257806393f1a40b146104c257600080fd5b80637247959a1461040a57806378e97925146104335780637ce3489b1461043c5780637fd6f15c1461044f5780638705fcd41461045857600080fd5b80633ad10ef6116101c95780635312ea8e1161018d5780635312ea8e146103bf578063630b5ba1146103d257806364757332146103da5780636eaddad2146103ef578063715018a61461040257600080fd5b80633ad10ef6146103485780634127535814610373578063441a3e7014610386578063457b34371461039957806351eb05a6146103ac57600080fd5b80631526fe27116102105780631526fe271461028d57806317caf6f1146102ec5780632111ff51146102f5578063225b87c41461030857806331cd61791461032857600080fd5b806289345214610241578063081e3eda1461025d5780630ba84cd2146102655780630d3365911461027a575b600080fd5b61024a600d5481565b6040519081526020015b60405180910390f35b60035461024a565b610278610273366004612895565b6105ca565b005b6102786102883660046128c3565b610628565b6102a061029b366004612895565b61064c565b604080516001600160a01b03909916895260208901979097529587019490945261ffff92831660608701529116608085015260a0840152151560c083015260e082015261010001610254565b61024a60075481565b610278610303366004612932565b6106b5565b61031b61031636600461299c565b610b2b565b60405161025491906129b9565b61024a61033636600461299c565b60106020526000908152604090205481565b600a5461035b906001600160a01b031681565b6040516001600160a01b039091168152602001610254565b60095461035b906001600160a01b031681565b610278610394366004612a32565b610c00565b6102786103a7366004612a54565b610c20565b6102786103ba366004612895565b610d52565b6102786103cd366004612895565b61108c565b610278611238565b6103e261125f565b6040516102549190612b2e565b6102786103fd366004612895565b611308565b610278611337565b61035b61041836600461299c565b600f602052600090815260409020546001600160a01b031681565b61024a60085481565b61027861044a366004612895565b61134b565b61024a600b5481565b61027861046636600461299c565b6113aa565b6001546001600160a01b031661035b565b61024a61048a366004612a32565b6113fa565b61027861049d366004612b71565b61144a565b6104b56104b0366004612baa565b61146f565b6040516102549190612bda565b6104f46104d0366004612baa565b60066020908152600092835260408084209091529082529020805460019091015482565b60408051928352602083019190915201610254565b61024a600e5481565b61024a68015af1d78b58c4000081565b610535610530366004612c13565b611687565b6040516102549190612cd8565b610278610550366004612895565b61177a565b61024a610563366004612baa565b6117d0565b61057b610576366004612895565b611918565b6040516102549190612d3a565b61027861059636600461299c565b611ae9565b6102786105a936600461299c565b611b69565b60025461035b906001600160a01b031681565b61024a600c5481565b6105d2611bdf565b68015af1d78b58c4000081111561061b5760405162461bcd60e51b81526020600482015260086024820152670e8dede40d0d2ced60c31b60448201526064015b60405180910390fd5b610623611238565b600d55565b610630611c39565b61063c84848484611c92565b6106466001600055565b50505050565b6003818154811061065c57600080fd5b600091825260209091206007909102018054600182015460028301546003840154600485015460058601546006909601546001600160a01b0390951696509294919361ffff8083169462010000909304169260ff169088565b6106bd611bdf565b60008590506000816001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015610702573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107269190612d49565b90506000826001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610768573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061078c9190612d49565b90506001600160a01b038216158015906107ae57506001600160a01b03811615155b6107fa5760405162461bcd60e51b815260206004820152601b60248201527f4d6173746572436865663a204f6e6c79204c5020746f6b656e732000000000006044820152606401610612565b6001600160a01b0388163b6108675760405162461bcd60e51b815260206004820152602d60248201527f4d6173746572436865663a204c5020746f6b656e206d7573742062652061207660448201526c185b1a590818dbdb9d1c9858dd609a1b6064820152608401610612565b6101908561ffff161115801561088357506101908461ffff1611155b61089f5760405162461bcd60e51b815260040161061290612d66565b6108aa600489612004565b156108f75760405162461bcd60e51b815260206004820152601c60248201527f4d6173746572436865663a204c5020616c7265616479206164646564000000006044820152606401610612565b861561090557610905611238565b6008544210156109245760085486101561091f5760085495505b610930565b42861015610930574295505b600060085442101580156109445750864210155b60408051610100810182526001600160a01b03808d168252602082018e81529282018b815261ffff808c16606085019081528b821660808601908152600060a087018181528915801560c08a0190815260e08a01848152600380546001810182559552995160079094027fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b8101805495909a166001600160a01b03199095169490941790985598517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85c83015594517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85d82015591517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85e8301805492518516620100000263ffffffff1990931691909416171790915590517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85f82015590517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f8608201805491151560ff1990921691909117905590517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f86190910155909150610b1357600754610b0f908b612029565b6007555b610b1e60048a612035565b5050505050505050505050565b60035460609060009067ffffffffffffffff811115610b4c57610b4c612dc3565b604051908082528060200260200182016040528015610baf57816020015b610b9c6040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b815260200190600190039081610b6a5790505b50905060005b600354811015610bf957610bc9818561146f565b828281518110610bdb57610bdb612dd9565b60200260200101819052508080610bf190612e05565b915050610bb5565b5092915050565b610c08611c39565b610c12828261204a565b610c1c6001600055565b5050565b610c28611bdf565b6101908261ffff1611158015610c4457506101908161ffff1611155b610c605760405162461bcd60e51b815260040161061290612d66565b610c68611238565b600060038581548110610c7d57610c7d612dd9565b60009182526020909120600790910201600581015490915060ff1615610cc457610cc084610cba836001015460075461232890919063ffffffff16565b90612029565b6007555b8381600101819055508260038681548110610ce157610ce1612dd9565b906000526020600020906007020160030160006101000a81548161ffff021916908361ffff1602179055508160038681548110610d2057610d20612dd9565b906000526020600020906007020160030160026101000a81548161ffff021916908361ffff1602179055505050505050565b600060038281548110610d6757610d67612dd9565b9060005260206000209060070201905080600201544211610d86575050565b600581015460ff16610db75760058101805460ff19166001908117909155810154600754610db391612029565b6007555b60068101546000819003610dd057504260029091015550565b60075415611081576000610de88360020154426113fa565b90506000610e01600d548361233490919063ffffffff16565b90506000610e28600754610e2287600101548561233490919063ffffffff16565b90612340565b90506000600b54600c54612710610e3f9190612e1e565b610e499190612e1e565b600254600a54600c549293506001600160a01b039182169263da1919b39290911690610e7e9061271090610e22908890612334565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015610ec9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eed9190612e31565b50600254600954600b546001600160a01b039283169263da1919b3921690610f1e9061271090610e22908890612334565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015610f69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f8d9190612e31565b50600254600e546001600160a01b039091169063da1919b3903090610fbb9061271090610e22908890612334565b610fcb612710610e228888612334565b610fd59190612e4e565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015611020573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110449190612e31565b5061107761106c612710610e22846110668a8389670de0b6b3a7640000612334565b90612334565b600488015490612029565b6004870155505050505b504260029091015550565b611094611c39565b6000600382815481106110a9576110a9612dd9565b600091825260208083208584526006909152604083206007909202019250816110cf3390565b6001600160a01b03168152602081019190915260400160002080549091508061113a5760405162461bcd60e51b815260206004820152601e60248201527f4d6173746572436865663a205573657220686173206e6f20616d6f756e7400006044820152606401610612565b60008083556001830155600383015462010000900461ffff16156111c257600383015460009061117d9061271090610e2290859062010000900461ffff16612334565b600954855491925061119c916001600160a01b0390811691168361234c565b6111bc336111aa8484612328565b86546001600160a01b0316919061234c565b506111d8565b6111d83384546001600160a01b0316908361234c565b808360060160008282546111ec9190612e1e565b9091555050604051818152849033907fbb757047c2b5f3974fe26b7c10f732e7bce710b0952a71082702781e62ae05959060200160405180910390a35050506112356001600055565b50565b60035460005b81811015610c1c5761124f81610d52565b61125881612e05565b905061123e565b60035460609060009067ffffffffffffffff81111561128057611280612dc3565b6040519080825280602002602001820160405280156112b957816020015b6112a661282f565b81526020019060019003908161129e5790505b50905060005b600354811015611302576112d281611918565b8282815181106112e4576112e4612dd9565b602002602001018190525080806112fa90612e05565b9150506112bf565b50919050565b611310611bdf565b6103e88111156113325760405162461bcd60e51b815260040161061290612e61565b600c55565b61133f611bdf565b61134960006123af565b565b611353611bdf565b6103e88111156113a55760405162461bcd60e51b815260206004820152601760248201527f4d6173746572436865663a20696e76616c6964206665650000000000000000006044820152606401610612565b600b55565b6113b2611bdf565b6001600160a01b0381166113d85760405162461bcd60e51b815260040161061290612e61565b600980546001600160a01b0319166001600160a01b0392909216919091179055565b600081831061140b57506000611444565b600854821161141c57506000611444565b60085483106114365761142f8284612328565b9050611444565b60085461142f908390612328565b92915050565b611452611c39565b3361145f84848484611c92565b5061146a6001600055565b505050565b6114a16040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b6000600384815481106114b6576114b6612dd9565b600091825260208083206040805161010081018252600790940290910180546001600160a01b03908116855260018083015486860152600283015486850152600383015461ffff808216606089015262010000909104166080870152600483015460a0870152600583015460ff16151560c087015260069283015460e08701528a8752918452828620908916865283528185208251808401909352805483520154918101919091529092509061156c86866117d0565b83516040516370a0823160e01b81526001600160a01b038881166004830152929350600092909116906370a0823190602401602060405180830381865afa1580156115bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115df9190612ea5565b6040805160a081018252898152855160208201528082018590526060810183905286519151636eb1769f60e11b81526001600160a01b038a8116600483015230602483015293945090926080840192169063dd62ed3e90604401602060405180830381865afa158015611656573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061167a9190612ea5565b9052979650505050505050565b6040805160008152602081019091526060908267ffffffffffffffff8111156116b2576116b2612dc3565b6040519080825280602002602001820160405280156116e557816020015b60608152602001906001900390816116d05790505b50915060005b83811015611772576117423086868481811061170957611709612dd9565b905060200281019061171b9190612ebe565b8560405160200161172e93929190612f0c565b604051602081830303815290604052612401565b83828151811061175457611754612dd9565b6020026020010181905250808061176a90612e05565b9150506116eb565b505092915050565b611782611bdf565b6101f48111156117cb5760405162461bcd60e51b815260206004820152601460248201527309ac2e6e8cae486d0cacc7440a8dede40d0d2ced60631b6044820152606401610612565b600e55565b600080600384815481106117e6576117e6612dd9565b60009182526020808320878452600680835260408086206001600160a01b038a16875290935291909320600460079093029093019182015490820154600283015492945090914211801561183957508015155b156118dc57600061184e8560020154426113fa565b90506000600b54600c546127106118659190612e1e565b61186f9190612e1e565b90506000611888600d548461233490919063ffffffff16565b905060006118b3612710610e2285611066600754610e228e600101548961233490919063ffffffff16565b90506118d56118ce86610e2284670de0b6b3a7640000612334565b8790612029565b9550505050505b61190d8360010154611907670de0b6b3a7640000610e2286886000015461233490919063ffffffff16565b90612328565b979650505050505050565b61192061282f565b60035482106119715760405162461bcd60e51b815260206004820152601c60248201527f4d6173746572436865663a20706964206f7574206f662072616e6765000000006044820152606401610612565b60006003838154811061198657611986612dd9565b600091825260208083206040805161010081018252600790940290910180546001600160a01b03168452600181015492840192909252600282015490830152600381015461ffff808216606085015262010000909104166080830152600481015460a0830152600581015460ff16151560c08301526006015460e0820152600b54600c5491935090611a1a90612710612e1e565b611a249190612e1e565b90506000600754600003611a3a57506000611a66565b611a63612710610e2284611066600754610e22600d548a6020015161233490919063ffffffff16565b90505b60405180610140016040528086815260200184600001516001600160a01b031681526020018460200151815260200184604001518152602001846060015161ffff168152602001846080015161ffff1681526020018460a0015181526020018460c00151151581526020018460e001518152602001828152509350505050919050565b611af1611bdf565b6001600160a01b038116611b475760405162461bcd60e51b815260206004820152601f60248201527f4d6173746572436865663a20496e76616c69642070657263656e7461676573006044820152606401610612565b600a80546001600160a01b0319166001600160a01b0392909216919091179055565b611b71611bdf565b6001600160a01b038116611bd65760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610612565b611235816123af565b6001546001600160a01b031633146113495760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610612565b600260005403611c8b5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610612565b6002600055565b6001600160a01b038181166000908152600f602052604090205416611d6f576001600160a01b03821615801590611cdb5750806001600160a01b0316826001600160a01b031614155b8015611cf057506001600160a01b0382163014155b611d3c5760405162461bcd60e51b815260206004820152601c60248201527f4d6173746572436865663a20496e76616c6964207265666572726572000000006044820152606401610612565b6001600160a01b038181166000908152600f6020526040902080546001600160a01b031916918416919091179055611d8d565b6001600160a01b038082166000908152600f60205260409020541691505b600060038581548110611da257611da2612dd9565b600091825260208083208884526006825260408085206001600160a01b0388168652909252922060079091029091019150611ddc86610d52565b805415611ed9576000611e148260010154611907670de0b6b3a7640000610e228760040154876000015461233490919063ffffffff16565b90508015611ed7576000612710600e5483611e2f9190612f33565b611e399190612f4a565b90508015611e88576001600160a01b038616600090815260106020526040902054611e65908290612e4e565b6001600160a01b038716600090815260106020526040902055611e888682612426565b611e928583612426565b846001600160a01b03167fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e048683604051611ecd91815260200190565b60405180910390a2505b505b8415611ef657611ef63383546001600160a01b03169030886124d1565b600382015461ffff1615611f76576003820154600090611f239061271090610e2290899061ffff16612334565b6009548454919250611f42916001600160a01b0390811691168361234c565b8154611f549082906119079089612029565b82556006830154611f6b9082906119079089612029565b600684015550611f99565b8054611f829086612029565b81556006820154611f939086612029565b60068301555b60048201548154611fb791670de0b6b3a764000091610e2291612334565b600182015560405185815286906001600160a01b038516907f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159060200160405180910390a3505050505050565b6001600160a01b038116600090815260018301602052604081205415155b9392505050565b60006120228284612e4e565b6000612022836001600160a01b038416612509565b600033905060006003848154811061206457612064612dd9565b600091825260208083208784526006825260408085206001600160a01b038816865290925292208054600790920290920192508411156120e65760405162461bcd60e51b815260206004820152601f60248201527f4d6173746572436865663a205573657220616d6f756e7420746f6f206c6f77006044820152606401610612565b6120ef85610d52565b6001600160a01b038084166000908152600f602052604081205460018401546004860154855492909416936121359261190791670de0b6b3a764000091610e2291612334565b905080156121f8576000612710600e54836121509190612f33565b61215a9190612f4a565b905080156121a9576001600160a01b038316600090815260106020526040902054612186908290612e4e565b6001600160a01b0384166000908152601060205260409020556121a98382612426565b6121b38683612426565b856001600160a01b03167fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e0486836040516121ee91815260200190565b60405180910390a2505b85156122a057825461220a9087612328565b8355600384015462010000900461ffff161561228a5760038401546000906122459061271090610e22908a9062010000900461ffff16612334565b6009548654919250612264916001600160a01b0390811691168361234c565b612284866122728984612328565b87546001600160a01b0316919061234c565b506122a0565b83546122a0906001600160a01b0316868861234c565b600484015483546122be91670de0b6b3a764000091610e2291612334565b8360010181905550858460060160008282546122da9190612e1e565b909155505060405186815287906001600160a01b038716907ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5689060200160405180910390a350505050505050565b60006120228284612e1e565b60006120228284612f33565b60006120228284612f4a565b6040516001600160a01b03831660248201526044810182905261146a90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612558565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60606120228383604051806060016040528060278152602001612f9c6027913961262d565b6002546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa15801561246f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124939190612ea5565b9050801561146a57808211156124ba5760025461146a906001600160a01b0316848361234c565b60025461146a906001600160a01b0316848461234c565b6040516001600160a01b03808516602483015283166044820152606481018290526106469085906323b872dd60e01b90608401612378565b600081815260018301602052604081205461255057508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155611444565b506000611444565b60006125ad826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166126a59092919063ffffffff16565b90508051600014806125ce5750808060200190518101906125ce9190612e31565b61146a5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610612565b6060600080856001600160a01b03168560405161264a9190612f6c565b600060405180830381855af49150503d8060008114612685576040519150601f19603f3d011682016040523d82523d6000602084013e61268a565b606091505b509150915061269b868383876126bc565b9695505050505050565b60606126b48484600085612735565b949350505050565b6060831561272b578251600003612724576001600160a01b0385163b6127245760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610612565b50816126b4565b6126b48383612805565b6060824710156127965760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610612565b600080866001600160a01b031685876040516127b29190612f6c565b60006040518083038185875af1925050503d80600081146127ef576040519150601f19603f3d011682016040523d82523d6000602084013e6127f4565b606091505b509150915061190d878383876126bc565b8151156128155781518083602001fd5b8060405162461bcd60e51b81526004016106129190612f88565b6040518061014001604052806000815260200160006001600160a01b031681526020016000815260200160008152602001600061ffff168152602001600061ffff1681526020016000815260200160001515815260200160008152602001600081525090565b6000602082840312156128a757600080fd5b5035919050565b6001600160a01b038116811461123557600080fd5b600080600080608085870312156128d957600080fd5b843593506020850135925060408501356128f2816128ae565b91506060850135612902816128ae565b939692955090935050565b801515811461123557600080fd5b803561ffff8116811461292d57600080fd5b919050565b60008060008060008060c0878903121561294b57600080fd5b86359550602087013561295d816128ae565b9450604087013561296d8161290d565b9350606087013592506129826080880161291b565b915061299060a0880161291b565b90509295509295509295565b6000602082840312156129ae57600080fd5b8135612022816128ae565b6020808252825182820181905260009190848201906040850190845b81811015612a2657612a1383855180518252602081015160208301526040810151604083015260608101516060830152608081015160808301525050565b9284019260a092909201916001016129d5565b50909695505050505050565b60008060408385031215612a4557600080fd5b50508035926020909101359150565b60008060008060808587031215612a6a57600080fd5b8435935060208501359250612a816040860161291b565b9150612a8f6060860161291b565b905092959194509250565b805182526020810151612ab860208401826001600160a01b03169052565b5060408101516040830152606081015160608301526080810151612ae2608084018261ffff169052565b5060a0810151612af860a084018261ffff169052565b5060c081015160c083015260e0810151612b1660e084018215159052565b50610100818101519083015261012090810151910152565b6020808252825182820181905260009190848201906040850190845b81811015612a2657612b5d838551612a9a565b928401926101409290920191600101612b4a565b600080600060608486031215612b8657600080fd5b83359250602084013591506040840135612b9f816128ae565b809150509250925092565b60008060408385031215612bbd57600080fd5b823591506020830135612bcf816128ae565b809150509250929050565b60a08101611444828480518252602081015160208301526040810151604083015260608101516060830152608081015160808301525050565b60008060208385031215612c2657600080fd5b823567ffffffffffffffff80821115612c3e57600080fd5b818501915085601f830112612c5257600080fd5b813581811115612c6157600080fd5b8660208260051b8501011115612c7657600080fd5b60209290920196919550909350505050565b60005b83811015612ca3578181015183820152602001612c8b565b50506000910152565b60008151808452612cc4816020860160208601612c88565b601f01601f19169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015612d2d57603f19888603018452612d1b858351612cac565b94509285019290850190600101612cff565b5092979650505050505050565b61014081016114448284612a9a565b600060208284031215612d5b57600080fd5b8151612022816128ae565b60208082526038908201527f4d6173746572436865663a20496e76616c6964206465706f736974206f72207760408201527f697468647261772066656520626173697320706f696e74730000000000000000606082015260800190565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201612e1757612e17612def565b5060010190565b8181038181111561144457611444612def565b600060208284031215612e4357600080fd5b81516120228161290d565b8082018082111561144457611444612def565b60208082526024908201527f4d6173746572436865663a205a65726f2061646472657373206e6f7420616c6c6040820152631bddd95960e21b606082015260800190565b600060208284031215612eb757600080fd5b5051919050565b6000808335601e19843603018112612ed557600080fd5b83018035915067ffffffffffffffff821115612ef057600080fd5b602001915036819003821315612f0557600080fd5b9250929050565b828482376000838201600081528351612f29818360208801612c88565b0195945050505050565b808202811582820484141761144457611444612def565b600082612f6757634e487b7160e01b600052601260045260246000fd5b500490565b60008251612f7e818460208701612c88565b9190910192915050565b6020815260006120226020830184612cac56fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b544478edf0b1f21d8df54091edb1a3e5d935726b7a6160e7369cddab6b352a664736f6c63430008140033

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

000000000000000000000000c36cc0594106090bd13f3b4166a552994186a7fb0000000000000000000000001464be15b9956591135b336e35cdeae9297b08e50000000000000000000000001464be15b9956591135b336e35cdeae9297b08e500000000000000000000000000000000000000000000000000000000000001f400000000000000000000000000000000000000000000000000000000000001f400000000000000000000000000000000000000000000000000038d7ea4c680000000000000000000000000000000000000000000000000000000000068502759

-----Decoded View---------------
Arg [0] : _rewardToken (address): 0xC36cc0594106090bd13f3b4166A552994186A7FB
Arg [1] : _feeAddress (address): 0x1464BE15b9956591135B336e35cDeAe9297B08e5
Arg [2] : _devAddress (address): 0x1464BE15b9956591135B336e35cDeAe9297B08e5
Arg [3] : _feePercent (uint256): 500
Arg [4] : _devPercent (uint256): 500
Arg [5] : _rewardsPerSec (uint256): 1000000000000000
Arg [6] : _startTime (uint256): 1750083417

-----Encoded View---------------
7 Constructor Arguments found :
Arg [0] : 000000000000000000000000c36cc0594106090bd13f3b4166a552994186a7fb
Arg [1] : 0000000000000000000000001464be15b9956591135b336e35cdeae9297b08e5
Arg [2] : 0000000000000000000000001464be15b9956591135b336e35cdeae9297b08e5
Arg [3] : 00000000000000000000000000000000000000000000000000000000000001f4
Arg [4] : 00000000000000000000000000000000000000000000000000000000000001f4
Arg [5] : 00000000000000000000000000000000000000000000000000038d7ea4c68000
Arg [6] : 0000000000000000000000000000000000000000000000000000000068502759


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

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ 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.