Address Details
contract

0x78674FA1bE6380d97f4e7064A4DcEC7dCC04ce4c

Contract Name
PlastikStaking
Creator
0x00ccaf–f0f31f at 0x115150–7ea825
Balance
0 CELO ( )
Locked CELO Balance
0.00 CELO
Voting CELO Balance
0.00 CELO
Pending Unlocked Gold
0.00 CELO
Tokens
Fetching tokens...
Transactions
3,143 Transactions
Transfers
1,956 Transfers
Gas Used
337,928,663
Last Balance Update
26811768
This contract has been verified via Sourcify. View contract in Sourcify repository
Contract name:
PlastikStaking




Optimization enabled
true
Compiler version
v0.8.6+commit.11564f7e




Optimization runs
100
EVM Version
berlin




Verified at
2023-05-29T17:25:27.006654Z

contracts/Staking.sol

//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";

contract PlastikStaking is Ownable, ReentrancyGuard {
    using SafeMath for uint256;
    using SafeMath for uint128;
    using SafeMath for uint64;
    using SafeERC20 for IERC20;

    /* ========== STATE VARIABLES ========== */

    IERC20 plastik;
    
    bool public hasUserLimit; // Whether a limit is set for users
    bool public isInitialized; // Whether it is initialized
    
    uint256 public accTokenPerShare; // Accrued token per share
    uint256 public bonusEndBlock; // The block number when Plasktik mining ends.
    uint256 public startBlock; // The block number when Plasktik mining starts.
    uint256 public lastRewardBlock; // The block number of the last pool update
    uint256 public poolLimitPerUser; // The pool limit (0 if none)
    uint256 public rewardPerBlock; // Plasktik tokens created per block.
    uint256 public PRECISION_FACTOR; // The precision factor
    uint256 private _totalStake; 
    uint256 private _totalStakeLongterm;
    uint256 private _totalAll; // total stake of flexible and longterm
    uint128 public constant SECONDS_IN_YEAR = 365 days;

    address public rewardDistributionAddress;

    mapping (address => UserInfo) public userInfo; // Info of each user that stakes tokens (stakedToken)
    mapping (uint256 => mapping (address => UserInfoLongTerm)) public userInfoLongTerm; // Info of each user that stakes tokens in each pool
    mapping (address => bool) public admin; // Admin of Contract

    struct UserInfo {
        uint256 amount; // How many staked tokens the user has provided
        uint256 rewardDebt; // Reward debt
        uint256 totalRewardEarned;
    }


    struct UserInfoLongTerm {
        uint256 amount; // How many staked tokens the user has provided
        uint128 timeStake; // Last action time of user
        uint128 endtime;  
        uint256 totalRewardEarned;
        bool staked;
    }

    // Info of each pool.
    struct PoolInfo {
        uint256 minDeposit; // minimun amount that can be deposit
        uint256 maxDeposit; // maximun amount that can be deposit
        uint256 limitStaking; // max slot can stake
        uint256 currentStaking; 
        uint128 period; // period of pool
        uint128 stopDay; // the day close pool
        uint64 APR; // APR of pool : 5000 = 50%
        bool status; // status of pool
    }
    
    
    // Info of each pool.
    PoolInfo[] public poolInfo;

    // Long Term
    event DepositLongTerm(uint256 _pid, uint256 amount);
    event WithdrawLongTerm(uint256 _pid, uint256 amount, uint256 pending);
    event ClaimLongTerm(uint256 _pid, uint256 pending);
    event RemoveAdmin(address user);
    event AddAdmin(address user);
    event ChangeToken(address token);
    event AddPool(uint256 id, uint256 _minDeposit, uint256 _maxDeposit, uint256 _currentStaking, uint256 _limitStaking, uint64 _APR, uint128 _period);
    event ClosePool(uint _pid, uint128 _stopDay);
    event UpdatePool(uint256 _pid, uint256 _minDeposit ,uint256 _currentStaking, uint256 _limitStaking, bool _status);

    // Flex
    event AdminTokenRecovery(address tokenRecovered, uint256 amount);
    event Deposit(uint256 amount, uint256 pendingFlex);
    event EmergencyWithdraw(uint256 amount);
    event NewStartAndEndBlocks(uint256 startBlock, uint256 endBlock);
    event NewRewardPerBlock(uint256 rewardPerBlock);
    event NewPoolLimit(uint256 poolLimitPerUser);
    event RewardsStop(uint256 blockNumber);
    event Withdraw(uint256 amount, uint256 pendingFlex);

    /* ========== CONSTRUCTOR ========== */

    constructor(address _rewardDistributionAddress, address _token) {
        plastik = IERC20(_token);
        rewardDistributionAddress = _rewardDistributionAddress;
        admin[msg.sender] = true;
    }

    function removeAdmin(address _RemoveAdmin) external onlyOwner {
        admin[_RemoveAdmin] = false;

        emit RemoveAdmin(_RemoveAdmin);
    }

    function addAdmin(address _AddAdmin) external onlyOwner {
        admin[_AddAdmin] = true;

        emit AddAdmin(_AddAdmin);
    }

    function changeToken(address _token) external onlyOwner {
        plastik = IERC20(_token);

        emit ChangeToken(_token);
    }

    /**
     * @notice Init flexible pool, 
     * @param _rewardPerBlock: amount of reward paid per block 
     * @param _startBlock: The first block will pay the reward 
     * @param _bonusEndBlock: The last block pays off 
     * @param _poolLimitPerUser: limit the number of tokens users can stake in the pool flexible, 0 mean no limit
     */
    function initialize(uint256 _rewardPerBlock, uint256 _startBlock, uint256 _bonusEndBlock, uint256 _poolLimitPerUser) external onlySystemAdmin {
        require(!isInitialized, "Already initialized");
        

        // Make this contract initialized
        isInitialized = true;

        rewardPerBlock = _rewardPerBlock;
        startBlock = _startBlock;
        bonusEndBlock = _bonusEndBlock;

        if (_poolLimitPerUser > 0) {
            hasUserLimit = true;
            poolLimitPerUser = _poolLimitPerUser;
        }

        uint256 decimalsRewardToken = uint256(9);
        require(decimalsRewardToken < 30, "Must be inferior to 30");

        PRECISION_FACTOR = uint256(10**(uint256(30).sub(decimalsRewardToken)));

        // Set the lastRewardBlock as the startBlock
        lastRewardBlock = startBlock;
    }

    /** Flex
     * @notice Create Pool Longterm 
     * @param _minDeposit: The minimum amount that the user has to deposit
     * @param _maxDeposit: the maximum amount that the user has to deposit
     * @param _limitStaking: limit the number of tokens that can be deposit
     * @param _APR: APR of pool 10000 -> 100%
     * @param _period: staking time of the package in seconds
     */
    function addPool(uint256 _minDeposit, uint256 _maxDeposit, uint256 _limitStaking, uint64 _APR, uint128 _period) external onlySystemAdmin {

        poolInfo.push(PoolInfo({
            minDeposit: _minDeposit,
            maxDeposit: _maxDeposit,
            limitStaking: _limitStaking,
            APR: _APR,
            period: _period,
            status: true,
            currentStaking: uint256(0),
            stopDay: uint128(0)
        }));

        uint256 _id = poolInfo.length.sub(1);

        emit AddPool(_id, _minDeposit, _maxDeposit, uint256(0), _limitStaking, _APR, _period);
    }

    function closePool(uint256 _pid) external onlySystemAdmin {
        PoolInfo storage pool = poolInfo[_pid];

        require(pool.status == true, "This Pool is closed");

        pool.status = false;
        pool.stopDay = uint128(block.timestamp);

        emit ClosePool(_pid, pool.stopDay);
    }

    /* ========== VIEWS ========== */


    // return total stake of flexible
    function totalFlexibleStaked() public view returns(uint256) {
        return _totalStake;
    }

    // return total stake of each pool
    function totalLongTermStaked(uint256 _pid) external view returns(uint256) {
        return poolInfo[_pid].currentStaking;
    }

    // return total stake of Longterm and Flexible
    function totalStakeAllPool() external view returns(uint256) {
        return _totalAll;
    }

    function systemAdmin(address _account) external view returns(bool) {
        return admin[_account];
    }

    function earned(uint256 _pid, address _user) public view returns (uint256) {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfoLongTerm storage user = userInfoLongTerm[_pid][_user];

        uint128 endUserStakedTime = uint128(block.timestamp.sub(user.timeStake));

        if (uint128(block.timestamp) >= user.timeStake.add(pool.period)) {
            endUserStakedTime = pool.period;

            if ((pool.stopDay <= user.timeStake.add(pool.period)) && (pool.status == false)) {
                endUserStakedTime = uint128(pool.stopDay.sub(user.timeStake));
                return ((((endUserStakedTime).mul(user.amount)).mul(pool.APR)).div(SECONDS_IN_YEAR)).div(10000);
            }

            return ((((endUserStakedTime).mul(user.amount)).mul(pool.APR)).div(SECONDS_IN_YEAR)).div(10000);
        }
        else {
            if (pool.status == false) {
                endUserStakedTime = uint128(pool.stopDay.sub(user.timeStake));
                return ((((endUserStakedTime).mul(user.amount)).mul(pool.APR)).div(SECONDS_IN_YEAR)).div(10000);
            }
        }

        return ((((endUserStakedTime).mul(user.amount)).mul(pool.APR)).div(SECONDS_IN_YEAR)).div(10000);
    }

    /* ========== FUNCTION ========== */

    /**
     * @notice Deposit staked tokens and collect reward tokens (if any)
     * @param _amount: amount to withdraw (in rewardToken)
     */
    function deposit(uint256 _amount) external nonReentrant {
        UserInfo storage user = userInfo[msg.sender];

        if (hasUserLimit) {
            require(_amount.add(user.amount) <= poolLimitPerUser, "User amount above limit");
        }

        _updatePool();

        uint256 pending;

        if (user.amount > 0) {
            pending = user.amount.mul(accTokenPerShare).div(PRECISION_FACTOR).sub(user.rewardDebt);
            if (pending > 0) {
                plastik.safeTransferFrom(address(rewardDistributionAddress), address(msg.sender), pending);
            }
        }

        if (_amount > 0) {
            user.amount = user.amount.add(_amount);
            plastik.safeTransferFrom(address(msg.sender), address(this), _amount);
        }

        user.totalRewardEarned = user.totalRewardEarned.add(pending);
        user.rewardDebt = user.amount.mul(accTokenPerShare).div(PRECISION_FACTOR);
        _totalStake = _totalStake.add(_amount);
        _totalAll = _totalAll.add(_amount);

        emit Deposit(_amount, pending);
    }

    /**
     * @notice Deposit staked tokens and collect reward tokens (if any)
     * @param _amount: amount to withdraw (in rewardToken)
     * @param _pid: id of long term pool
     */
    function depositLongTerm(uint256 _pid, uint256 _amount) external nonReentrant {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfoLongTerm storage user = userInfoLongTerm[_pid][msg.sender];

        uint256 ftAmount = user.amount.add(_amount);

        require(pool.status, "This pool is close");
        require(user.staked == false, "You are Staking");
        require(_amount > 0, "Invalid Amount");
        require(ftAmount >= pool.minDeposit && ftAmount <= pool.maxDeposit, "Invalid Amount");
        require(pool.currentStaking.add(_amount) <= pool.limitStaking, "Full");

        plastik.safeTransferFrom(address(msg.sender), address(this), _amount);

        user.amount = user.amount.add(_amount);
        user.timeStake = uint128(block.timestamp);
        user.endtime = uint128(user.timeStake.add(poolInfo[_pid].period));
        user.staked = true;
        pool.currentStaking = pool.currentStaking.add(_amount);
        _totalAll = _totalAll.add(_amount);
        
        emit UpdatePool(_pid, pool.minDeposit, pool.currentStaking, pool.limitStaking, pool.status);
        emit DepositLongTerm(_pid, _amount);
    }

    /**
     * @notice Withdraw staked tokens and collect reward tokens
     * @param _amount: amount to withdraw (in rewardToken)
     */
    function withdraw(uint256 _amount) external nonReentrant {
        UserInfo storage user = userInfo[msg.sender];
        require(user.amount >= _amount, "Amount to withdraw too high");

        _updatePool();

        uint256 pending = user.amount.mul(accTokenPerShare).div(PRECISION_FACTOR).sub(user.rewardDebt);

        if (_amount > 0) {
            user.amount = user.amount.sub(_amount);
            plastik.safeTransfer(address(msg.sender), _amount);
        }

        if (pending > 0) {
            plastik.safeTransferFrom(address(rewardDistributionAddress), address(msg.sender), pending);
        }

        user.totalRewardEarned = user.totalRewardEarned.add(pending);
        user.rewardDebt = user.amount.mul(accTokenPerShare).div(PRECISION_FACTOR);
        _totalStake = _totalStake.sub(_amount);
        _totalAll = _totalAll.sub(_amount);

        emit Withdraw(_amount, pending);
    }

    /**
     * @notice Withdraw staked tokens and collect reward tokens
     * @param _pid: id of long term pool
     */
    function withdrawLongTerm(uint256 _pid) external nonReentrant {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfoLongTerm storage user = userInfoLongTerm[_pid][msg.sender];

        uint128 userTimeStake = uint128((uint128(block.timestamp)).sub(user.timeStake));
        uint256 pending;

        if (pool.status == true) {
            if (userTimeStake >= pool.period) {
                pending = earned(_pid, msg.sender);
                plastik.safeTransferFrom(address(rewardDistributionAddress), address(msg.sender), pending);
            }
        } 
        else {
            pending = earned(_pid, msg.sender);
            plastik.safeTransferFrom(address(rewardDistributionAddress), address(msg.sender), pending);
        }

        if (pending == 0) { 
            pool.currentStaking = pool.currentStaking.sub(user.amount);
        }
        else {
            pool.limitStaking = pool.limitStaking.sub(user.amount);
            pool.currentStaking = pool.currentStaking.sub(user.amount);
            emit ClaimLongTerm(_pid, pending);
        }

        plastik.safeTransfer(address(msg.sender), user.amount);

        uint256 withdrawAmount = user.amount;

        user.staked = false;
        user.amount = user.amount.sub(user.amount);
        user.totalRewardEarned = user.totalRewardEarned.add(pending);
        _totalAll = _totalAll.sub(user.amount);
        
        emit UpdatePool(_pid, pool.minDeposit, pool.currentStaking, pool.limitStaking, pool.status);
        emit WithdrawLongTerm(_pid, withdrawAmount, pending);
    }

    /**
     * @notice Withdraw staked tokens without caring about rewards rewards
     * @dev Needs to be for emergency.
     */
    function emergencyWithdraw() external nonReentrant {
        UserInfo storage user = userInfo[msg.sender];
        uint256 amountToTransfer = user.amount;
        user.amount = 0;
        user.rewardDebt = 0;

        if (amountToTransfer > 0) {
            plastik.safeTransfer(address(msg.sender), amountToTransfer);
        }

        emit EmergencyWithdraw(user.amount);
    }

    /**
     * @notice Stop rewards
     * @dev Only callable by owner. Needs to be for emergency.
     */
    function emergencyRewardWithdraw(uint256 _amount) external onlySystemAdmin {
        plastik.safeTransfer(address(msg.sender), _amount);
    }

    /**
     * @notice It allows the admin to recover wrong tokens sent to the contract
     * @param _tokenAddress: the address of the token to withdraw
     * @param _tokenAmount: the number of tokens to withdraw
     * @dev This function is only callable by admin.
     */
    function recoverWrongTokens(address _tokenAddress, uint256 _tokenAmount) external onlySystemAdmin {
        require(_tokenAddress != address(plastik), "Cannot be staked/reward token");

        IERC20(_tokenAddress).safeTransfer(address(msg.sender), _tokenAmount);

        emit AdminTokenRecovery(_tokenAddress, _tokenAmount);
    }

    /**
     * @notice Stop rewards
     * @dev Only callable by owner
     */
    function stopReward() external onlySystemAdmin {
        bonusEndBlock = block.number;
    }

    /**
     * @notice Update pool limit per user
     * @dev Only callable by owner.
     * @param _hasUserLimit: whether the limit remains forced
     * @param _poolLimitPerUser: new pool limit per user
     */
    function updatePoolLimitPerUser(bool _hasUserLimit, uint256 _poolLimitPerUser) external onlySystemAdmin {
        //require(hasUserLimit, "Must be set");
        if (_hasUserLimit) {
            require(_poolLimitPerUser > poolLimitPerUser, "New limit must be higher");
            poolLimitPerUser = _poolLimitPerUser;
            hasUserLimit = _hasUserLimit;
        } else {
            hasUserLimit = _hasUserLimit;
            poolLimitPerUser = 0;
        }
        emit NewPoolLimit(poolLimitPerUser);
    }

    /**
     * @notice Update reward per block
     * @dev Only callable by owner.
     * @param _rewardPerBlock: the reward per block
     */
    function updateRewardPerBlock(uint256 _rewardPerBlock) external onlySystemAdmin {
        //require(block.number < startBlock, "Pool has started");
        _updatePool();
        rewardPerBlock = _rewardPerBlock;
        emit NewRewardPerBlock(_rewardPerBlock);
    }

    /**
     * @notice It allows the admin to update start and end blocks
     * @dev This function is only callable by owner.
     * @param _startBlock: the new start block
     * @param _bonusEndBlock: the new end block
     */
    function updateStartAndEndBlocks(uint256 _startBlock, uint256 _bonusEndBlock) external onlySystemAdmin {
        //require(block.number < startBlock, "Pool has started");
        require(_startBlock < _bonusEndBlock, "New startBlock must be lower than new endBlock");
        require(block.number < _startBlock, "New startBlock must be higher than current block");

        startBlock = _startBlock;
        bonusEndBlock = _bonusEndBlock;

        // Set the lastRewardBlock as the startBlock
        lastRewardBlock = startBlock;

        emit NewStartAndEndBlocks(_startBlock, _bonusEndBlock);
    }

    /**
     * @notice View function to see pending reward on frontend.
     * @param _user: user address
     * @return Pending reward for a given user
     */
    function pendingReward(address _user) external view returns (uint256) {
        UserInfo storage user = userInfo[_user];
        
        uint256 stakedTokenSupply = totalFlexibleStaked();
        if (block.number > lastRewardBlock && stakedTokenSupply != 0) {
            uint256 multiplier = _getMultiplier(lastRewardBlock, block.number);
            uint256 plastikReward = multiplier.mul(rewardPerBlock);
            uint256 adjustedTokenPerShare =
                accTokenPerShare.add(plastikReward.mul(PRECISION_FACTOR).div(stakedTokenSupply));
            return user.amount.mul(adjustedTokenPerShare).div(PRECISION_FACTOR).sub(user.rewardDebt);
        } else {
            return user.amount.mul(accTokenPerShare).div(PRECISION_FACTOR).sub(user.rewardDebt);
        }
    }

    /**
     * @notice Update reward variables of the given pool to be up-to-date.
     */
    function _updatePool() internal {
        if (block.number <= lastRewardBlock) {
            return;
        }

        uint256 stakedTokenSupply = totalFlexibleStaked();

        if (stakedTokenSupply == 0) {
            lastRewardBlock = block.number;
            return;
        }

        uint256 multiplier = _getMultiplier(lastRewardBlock, block.number);
        uint256 plastikReward = multiplier.mul(rewardPerBlock);
        accTokenPerShare = accTokenPerShare.add(plastikReward.mul(PRECISION_FACTOR).div(stakedTokenSupply));
        lastRewardBlock = block.number;
    }

    /**
     * @notice Return reward multiplier over the given _from to _to block.
     * @param _from: block to start
     * @param _to: block to finish
     */
    function _getMultiplier(uint256 _from, uint256 _to) internal view returns (uint256) {
        if (_to <= bonusEndBlock) {
            return _to.sub(_from);
        } else if (_from >= bonusEndBlock) {
            return 0;
        } else {
            return bonusEndBlock.sub(_from);
        }
    }

    /* ========== MODIFIERS ========== */

    modifier onlySystemAdmin() {
        require(admin[msg.sender] == true, "Caller is not admin");
        _;
    }

}
        

/_openzeppelin/contracts/access/Ownable.sol

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

/_openzeppelin/contracts/security/ReentrancyGuard.sol

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

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

/_openzeppelin/contracts/token/ERC20/ERC20.sol

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

pragma solidity ^0.8.0;

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

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

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

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

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

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

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

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

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

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

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

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

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

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

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

        return true;
    }

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

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
        }
        _balances[to] += amount;

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/_openzeppelin/contracts/token/ERC20/IERC20.sol

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

/_openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol

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

pragma solidity ^0.8.0;

import "../IERC20.sol";

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

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

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

/_openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

/_openzeppelin/contracts/utils/Address.sol

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/_openzeppelin/contracts/utils/Context.sol

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

pragma solidity ^0.8.0;

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

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

/_openzeppelin/contracts/utils/math/Math.sol

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

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a >= b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a / b + (a % b == 0 ? 0 : 1);
    }
}
          

/_openzeppelin/contracts/utils/math/SafeMath.sol

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_rewardDistributionAddress","internalType":"address"},{"type":"address","name":"_token","internalType":"address"}]},{"type":"event","name":"AddAdmin","inputs":[{"type":"address","name":"user","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"AddPool","inputs":[{"type":"uint256","name":"id","internalType":"uint256","indexed":false},{"type":"uint256","name":"_minDeposit","internalType":"uint256","indexed":false},{"type":"uint256","name":"_maxDeposit","internalType":"uint256","indexed":false},{"type":"uint256","name":"_currentStaking","internalType":"uint256","indexed":false},{"type":"uint256","name":"_limitStaking","internalType":"uint256","indexed":false},{"type":"uint64","name":"_APR","internalType":"uint64","indexed":false},{"type":"uint128","name":"_period","internalType":"uint128","indexed":false}],"anonymous":false},{"type":"event","name":"AdminTokenRecovery","inputs":[{"type":"address","name":"tokenRecovered","internalType":"address","indexed":false},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"ChangeToken","inputs":[{"type":"address","name":"token","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"ClaimLongTerm","inputs":[{"type":"uint256","name":"_pid","internalType":"uint256","indexed":false},{"type":"uint256","name":"pending","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"ClosePool","inputs":[{"type":"uint256","name":"_pid","internalType":"uint256","indexed":false},{"type":"uint128","name":"_stopDay","internalType":"uint128","indexed":false}],"anonymous":false},{"type":"event","name":"Deposit","inputs":[{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"uint256","name":"pendingFlex","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"DepositLongTerm","inputs":[{"type":"uint256","name":"_pid","internalType":"uint256","indexed":false},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"EmergencyWithdraw","inputs":[{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"NewPoolLimit","inputs":[{"type":"uint256","name":"poolLimitPerUser","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"NewRewardPerBlock","inputs":[{"type":"uint256","name":"rewardPerBlock","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"NewStartAndEndBlocks","inputs":[{"type":"uint256","name":"startBlock","internalType":"uint256","indexed":false},{"type":"uint256","name":"endBlock","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"RemoveAdmin","inputs":[{"type":"address","name":"user","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"RewardsStop","inputs":[{"type":"uint256","name":"blockNumber","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"UpdatePool","inputs":[{"type":"uint256","name":"_pid","internalType":"uint256","indexed":false},{"type":"uint256","name":"_minDeposit","internalType":"uint256","indexed":false},{"type":"uint256","name":"_currentStaking","internalType":"uint256","indexed":false},{"type":"uint256","name":"_limitStaking","internalType":"uint256","indexed":false},{"type":"bool","name":"_status","internalType":"bool","indexed":false}],"anonymous":false},{"type":"event","name":"Withdraw","inputs":[{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"uint256","name":"pendingFlex","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"WithdrawLongTerm","inputs":[{"type":"uint256","name":"_pid","internalType":"uint256","indexed":false},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"uint256","name":"pending","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"PRECISION_FACTOR","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint128","name":"","internalType":"uint128"}],"name":"SECONDS_IN_YEAR","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"accTokenPerShare","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addAdmin","inputs":[{"type":"address","name":"_AddAdmin","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addPool","inputs":[{"type":"uint256","name":"_minDeposit","internalType":"uint256"},{"type":"uint256","name":"_maxDeposit","internalType":"uint256"},{"type":"uint256","name":"_limitStaking","internalType":"uint256"},{"type":"uint64","name":"_APR","internalType":"uint64"},{"type":"uint128","name":"_period","internalType":"uint128"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"admin","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"bonusEndBlock","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"changeToken","inputs":[{"type":"address","name":"_token","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"closePool","inputs":[{"type":"uint256","name":"_pid","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"deposit","inputs":[{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"depositLongTerm","inputs":[{"type":"uint256","name":"_pid","internalType":"uint256"},{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"earned","inputs":[{"type":"uint256","name":"_pid","internalType":"uint256"},{"type":"address","name":"_user","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"emergencyRewardWithdraw","inputs":[{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"emergencyWithdraw","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"hasUserLimit","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"uint256","name":"_rewardPerBlock","internalType":"uint256"},{"type":"uint256","name":"_startBlock","internalType":"uint256"},{"type":"uint256","name":"_bonusEndBlock","internalType":"uint256"},{"type":"uint256","name":"_poolLimitPerUser","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isInitialized","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"lastRewardBlock","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"pendingReward","inputs":[{"type":"address","name":"_user","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"minDeposit","internalType":"uint256"},{"type":"uint256","name":"maxDeposit","internalType":"uint256"},{"type":"uint256","name":"limitStaking","internalType":"uint256"},{"type":"uint256","name":"currentStaking","internalType":"uint256"},{"type":"uint128","name":"period","internalType":"uint128"},{"type":"uint128","name":"stopDay","internalType":"uint128"},{"type":"uint64","name":"APR","internalType":"uint64"},{"type":"bool","name":"status","internalType":"bool"}],"name":"poolInfo","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"poolLimitPerUser","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"recoverWrongTokens","inputs":[{"type":"address","name":"_tokenAddress","internalType":"address"},{"type":"uint256","name":"_tokenAmount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeAdmin","inputs":[{"type":"address","name":"_RemoveAdmin","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"rewardDistributionAddress","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"rewardPerBlock","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"startBlock","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"stopReward","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"systemAdmin","inputs":[{"type":"address","name":"_account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalFlexibleStaked","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalLongTermStaked","inputs":[{"type":"uint256","name":"_pid","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalStakeAllPool","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updatePoolLimitPerUser","inputs":[{"type":"bool","name":"_hasUserLimit","internalType":"bool"},{"type":"uint256","name":"_poolLimitPerUser","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateRewardPerBlock","inputs":[{"type":"uint256","name":"_rewardPerBlock","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateStartAndEndBlocks","inputs":[{"type":"uint256","name":"_startBlock","internalType":"uint256"},{"type":"uint256","name":"_bonusEndBlock","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"uint256","name":"rewardDebt","internalType":"uint256"},{"type":"uint256","name":"totalRewardEarned","internalType":"uint256"}],"name":"userInfo","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"uint128","name":"timeStake","internalType":"uint128"},{"type":"uint128","name":"endtime","internalType":"uint128"},{"type":"uint256","name":"totalRewardEarned","internalType":"uint256"},{"type":"bool","name":"staked","internalType":"bool"}],"name":"userInfoLongTerm","inputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdraw","inputs":[{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdrawLongTerm","inputs":[{"type":"uint256","name":"_pid","internalType":"uint256"}]}]
              

Contract Creation Code

0x60806040523480156200001157600080fd5b506040516200286938038062002869833981016040819052620000349162000100565b6200003f3362000093565b6001808055600280546001600160a01b039384166001600160a01b031991821617909155600d8054949093169316929092179055336000908152601060205260409020805460ff1916909117905562000138565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b0381168114620000fb57600080fd5b919050565b600080604083850312156200011457600080fd5b6200011f83620000e3565b91506200012f60208401620000e3565b90509250929050565b61272180620001486000396000f3fe608060405234801561001057600080fd5b50600436106102535760003560e01c806370480275116101465780639bb10d3f116100c3578063ccd34cd511610087578063ccd34cd5146105f9578063db2e21bc14610602578063e39c08fc1461060a578063f07b24921461061d578063f2fde38b14610625578063f40f0f521461063857600080fd5b80639bb10d3f146105af578063a0b40905146105b7578063a9f8d181146105ca578063b6b55f25146105d3578063c00dc47b146105e657600080fd5b80638ae39cac1161010a5780638ae39cac1461056e5780638da5cb5b146105775780638f6629151461057f57806392e8990e146105885780639513997f1461059c57600080fd5b80637048027514610518578063715018a61461052b57806372e138481461053357806380dc067214610553578063811d7a981461055b57600080fd5b8063392e53cd116101d457806360a2da441161019857806360a2da441461043957806363a846f81461044c57806366829b161461046f57806366fe9f8a1461048257806367c370fe1461048b57600080fd5b8063392e53cd146103d35780633f138d4b146103e757806348cd4cb1146103fa578063503653b8146104035780635dcc93911461041657600080fd5b80631aed65531161021b5780631aed6553146103705780631fb2dfd8146103875780632e1a7d4d1461039a5780633279beab146103ad57806337de615f146103c057600080fd5b806301f8a9761461025857806313992a1b1461026d5780631526fe27146102ae5780631785f53c146103135780631959a00214610326575b600080fd5b61026b6102663660046122ff565b61064b565b005b61029961027b36600461227f565b6001600160a01b031660009081526010602052604090205460ff1690565b60405190151581526020015b60405180910390f35b6102c16102bc3660046122ff565b6106cc565b6040805198895260208901979097529587019490945260608601929092526001600160801b0390811660808601521660a08401526001600160401b031660c0830152151560e0820152610100016102a5565b61026b61032136600461227f565b61073c565b61035561033436600461227f565b600e6020526000908152604090208054600182015460029092015490919083565b604080519384526020840192909252908201526060016102a5565b61037960045481565b6040519081526020016102a5565b61026b610395366004612398565b6107bb565b61026b6103a83660046122ff565b6109fc565b61026b6103bb3660046122ff565b610ba5565b61026b6103ce3660046122ff565b610bf3565b60025461029990600160a81b900460ff1681565b61026b6103f536600461229a565b610d1c565b61037960055481565b61026b6104113660046122ff565b610e01565b6104216301e1338081565b6040516001600160801b0390911681526020016102a5565b61026b610447366004612366565b6110b1565b61029961045a36600461227f565b60106020526000908152604090205460ff1681565b61026b61047d36600461227f565b61119e565b61037960075481565b6104e2610499366004612318565b600f602090815260009283526040808420909152908252902080546001820154600283015460039093015491926001600160801b0380831693600160801b909304169160ff1685565b604080519586526001600160801b039485166020870152929093169184019190915260608301521515608082015260a0016102a5565b61026b61052636600461227f565b611218565b61026b61129a565b600d54610546906001600160a01b031681565b6040516102a59190612422565b61026b6112d5565b61026b610569366004612344565b61130f565b61037960085481565b610546611644565b61037960035481565b60025461029990600160a01b900460ff1681565b61026b6105aa366004612344565b611653565b600a54610379565b61026b6105c53660046122e1565b61179a565b61037960065481565b61026b6105e13660046122ff565b611891565b6103796105f43660046122ff565b611a44565b61037960095481565b61026b611a72565b610379610618366004612318565b611b12565b600c54610379565b61026b61063336600461227f565b611d2a565b61037961064636600461227f565b611dc7565b3360009081526010602052604090205460ff1615156001146106885760405162461bcd60e51b815260040161067f906124c6565b60405180910390fd5b610690611eb1565b60088190556040518181527f0c4d677eef92893ac7ec52faf8140fc6c851ab4736302b4f3a89dfb20696a0df906020015b60405180910390a150565b601181815481106106dc57600080fd5b6000918252602090912060069091020180546001820154600283015460038401546004850154600590950154939550919390926001600160801b0380831692600160801b900416906001600160401b03811690600160401b900460ff1688565b33610745611644565b6001600160a01b03161461076b5760405162461bcd60e51b815260040161067f90612491565b6001600160a01b03811660009081526010602052604090819020805460ff19169055517f753f40ca3312b2408759a67875b367955e7baa221daf08aa3d643d96202ac12b906106c1908390612422565b3360009081526010602052604090205460ff1615156001146107ef5760405162461bcd60e51b815260040161067f906124c6565b6040805161010081018252868152602081018681529181018581526000606083018181526001600160801b038087166080860190815260a086018481526001600160401b03808b1660c08901908152600160e08a01818152601180548084018255818b529b516006909c027f31ecc21a745e3968a04e9570e4425bc18fa8019c68028196b546d1669c200c6881019c909c559b517f31ecc21a745e3968a04e9570e4425bc18fa8019c68028196b546d1669c200c698c015598517f31ecc21a745e3968a04e9570e4425bc18fa8019c68028196b546d1669c200c6a8b015595517f31ecc21a745e3968a04e9570e4425bc18fa8019c68028196b546d1669c200c6b8a0155925191518416600160801b0291909316177f31ecc21a745e3968a04e9570e4425bc18fa8019c68028196b546d1669c200c6c870155517f31ecc21a745e3968a04e9570e4425bc18fa8019c68028196b546d1669c200c6d909501805494511515600160401b0268ffffffffffffffffff19909516959091169490941792909217909255915490916109849190611f26565b604080518281526020810189905290810187905260006060820152608081018690526001600160401b03851660a08201526001600160801b03841660c08201529091507fd98a31fab58d7aa359be348baa21a1d70c2f7e9866815dffa79759cbfaa4d2259060e00160405180910390a1505050505050565b60026001541415610a1f5760405162461bcd60e51b815260040161067f906124f3565b6002600155336000908152600e602052604090208054821115610a845760405162461bcd60e51b815260206004820152601b60248201527f416d6f756e7420746f20776974686472617720746f6f20686967680000000000604482015260640161067f565b610a8c611eb1565b6000610ac18260010154610abb600954610ab56003548760000154611f3990919063ffffffff16565b90611f45565b90611f26565b90508215610aee578154610ad59084611f26565b8255600254610aee906001600160a01b03163385611f51565b8015610b1257600d54600254610b12916001600160a01b0391821691163384611fb9565b6002820154610b219082611ff7565b60028301556009546003548354610b3d9291610ab59190611f39565b6001830155600a54610b4f9084611f26565b600a55600c54610b5f9084611f26565b600c5560408051848152602081018390527f56ca301a9219608c91e7bcee90e083c19671d2cdcc96752c7af291cee5f9c8c891015b60405180910390a150506001805550565b3360009081526010602052604090205460ff161515600114610bd95760405162461bcd60e51b815260040161067f906124c6565b600254610bf0906001600160a01b03163383611f51565b50565b3360009081526010602052604090205460ff161515600114610c275760405162461bcd60e51b815260040161067f906124c6565b600060118281548110610c3c57610c3c6126c7565b906000526020600020906006020190508060050160089054906101000a900460ff1615156001151514610ca75760405162461bcd60e51b8152602060048201526013602482015272151a1a5cc8141bdbdb081a5cc818db1bdcd959606a1b604482015260640161067f565b60058101805460ff60401b191690556004810180546001600160801b03908116600160801b42831681029190911792839055604080518681529190930490911660208201527f11a7044d16b19253bc3b2610e57a5cbc9ac8b41fb1d0558df170493dca4c631d91015b60405180910390a15050565b3360009081526010602052604090205460ff161515600114610d505760405162461bcd60e51b815260040161067f906124c6565b6002546001600160a01b0383811691161415610dae5760405162461bcd60e51b815260206004820152601d60248201527f43616e6e6f74206265207374616b65642f72657761726420746f6b656e000000604482015260640161067f565b610dc26001600160a01b0383163383611f51565b604080516001600160a01b0384168152602081018390527f74545154aac348a3eac92596bd1971957ca94795f4e954ec5f613b55fab781299101610d10565b60026001541415610e245760405162461bcd60e51b815260040161067f906124f3565b6002600181905550600060118281548110610e4157610e416126c7565b60009182526020808320858452600f825260408085203386529092529083206001810154600690930290910193509190610e8890426001600160801b039081169116611f26565b905060008360050160089054906101000a900460ff161515600115151415610ef25760048401546001600160801b0390811690831610610eed57610ecc8533611b12565b600d54600254919250610eed916001600160a01b0390811691163384611fb9565b610f1d565b610efc8533611b12565b600d54600254919250610f1d916001600160a01b0390811691163384611fb9565b80610f3c5782546003850154610f3291611f26565b6003850155610fa0565b82546002850154610f4c91611f26565b600285015582546003850154610f6191611f26565b600385015560408051868152602081018390527fe4ef83d75d0957b32280b1d2ef8a2ea64492482f14fa43952fb008c304c34a23910160405180910390a15b8254600254610fbc916001600160a01b03909116903390611f51565b825460038401805460ff19169055610fd48180611f26565b84556002840154610fe59083611ff7565b60028501558354600c54610ff891611f26565b600c558454600386015460028701546005880154604080518b815260208101959095528401929092526060830152600160401b900460ff16151560808201527f7fc368d8322542813b2cc45a7e05a897acb9c1878f6053a78125c4e65936e5399060a00160405180910390a160408051878152602081018390529081018390527f7ce60cb683ee7d23692b92416a3edd808b8bc7d04be198d3516639a8b0509cae9060600160405180910390a150506001805550505050565b3360009081526010602052604090205460ff1615156001146110e55760405162461bcd60e51b815260040161067f906124c6565b600254600160a81b900460ff16156111355760405162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481a5b9a5d1a585b1a5e9959606a1b604482015260640161067f565b6002805460ff60a81b1916600160a81b1790556008849055600583905560048290558015611176576002805460ff60a01b1916600160a01b17905560078190555b6009611183601e82611f26565b61118e90600a6125a7565b6009555050600554600655505050565b336111a7611644565b6001600160a01b0316146111cd5760405162461bcd60e51b815260040161067f90612491565b600280546001600160a01b0319166001600160a01b0383161790556040517fa923c109999878794766ef1a56d61e2ec803c77b531bda96f8edbe09c458a32c906106c1908390612422565b33611221611644565b6001600160a01b0316146112475760405162461bcd60e51b815260040161067f90612491565b6001600160a01b03811660009081526010602052604090819020805460ff19166001179055517fad6de4452a631e641cb59902236607946ce9272b9b981f2f80e8d129cb9084ba906106c1908390612422565b336112a3611644565b6001600160a01b0316146112c95760405162461bcd60e51b815260040161067f90612491565b6112d36000612003565b565b3360009081526010602052604090205460ff1615156001146113095760405162461bcd60e51b815260040161067f906124c6565b43600455565b600260015414156113325760405162461bcd60e51b815260040161067f906124f3565b600260018190555060006011838154811061134f5761134f6126c7565b60009182526020808320868452600f8252604080852033865290925290832080546006909302909101935091906113869085611ff7565b6005840154909150600160401b900460ff166113d95760405162461bcd60e51b81526020600482015260126024820152715468697320706f6f6c20697320636c6f736560701b604482015260640161067f565b600382015460ff16156114205760405162461bcd60e51b815260206004820152600f60248201526e596f7520617265205374616b696e6760881b604482015260640161067f565b600084116114405760405162461bcd60e51b815260040161067f90612469565b82548110801590611455575082600101548111155b6114715760405162461bcd60e51b815260040161067f90612469565b600283015460038401546114859086611ff7565b11156114bc5760405162461bcd60e51b815260040161067f90602080825260049082015263119d5b1b60e21b604082015260600190565b6002546114d4906001600160a01b0316333087611fb9565b81546114e09085611ff7565b82556001820180546001600160801b031916426001600160801b031617905560118054611543919087908110611518576115186126c7565b600091825260209091206004600690920201015460018401546001600160801b039081169116611ff7565b600180840180546001600160801b03938416600160801b029316929092179091556003808401805460ff19169092179091558301546115829085611ff7565b6003840155600c546115949085611ff7565b600c558254600384015460028501546005860154604080518a815260208101959095528401929092526060830152600160401b900460ff16151560808201527f7fc368d8322542813b2cc45a7e05a897acb9c1878f6053a78125c4e65936e5399060a00160405180910390a160408051868152602081018690527fe1331ce3f664fb73189b50ae3df3a60a4a3ff376c058b74b21d3297187195f1d910160405180910390a1505060018055505050565b6000546001600160a01b031690565b3360009081526010602052604090205460ff1615156001146116875760405162461bcd60e51b815260040161067f906124c6565b8082106116ed5760405162461bcd60e51b815260206004820152602e60248201527f4e6577207374617274426c6f636b206d757374206265206c6f7765722074686160448201526d6e206e657720656e64426c6f636b60901b606482015260840161067f565b8143106117555760405162461bcd60e51b815260206004820152603060248201527f4e6577207374617274426c6f636b206d7573742062652068696768657220746860448201526f616e2063757272656e7420626c6f636b60801b606482015260840161067f565b60058290556004819055600682905560408051838152602081018390527f7cd0ab87d19036f3dfadadb232c78aa4879dda3f0c994a9d637532410ee2ce069101610d10565b3360009081526010602052604090205460ff1615156001146117ce5760405162461bcd60e51b815260040161067f906124c6565b81156118415760075481116118205760405162461bcd60e51b81526020600482015260186024820152772732bb903634b6b4ba1036bab9ba103132903434b3b432b960411b604482015260640161067f565b60078190556002805460ff60a01b1916600160a01b8415150217905561185e565b6002805460ff60a01b1916600160a01b8415150217905560006007555b7f241f67ee5f41b7a5cabf911367329be7215900f602ebfc47f89dce2a6bcd847c600754604051610d1091815260200190565b600260015414156118b45760405162461bcd60e51b815260040161067f906124f3565b60026001819055336000908152600e602052604090209054600160a01b900460ff16156119335760075481546118eb908490611ff7565b11156119335760405162461bcd60e51b8152602060048201526017602482015276155cd95c88185b5bdd5b9d0818589bdd99481b1a5b5a5d604a1b604482015260640161067f565b61193b611eb1565b8054600090156119925761196c8260010154610abb600954610ab56003548760000154611f3990919063ffffffff16565b9050801561199257600d54600254611992916001600160a01b0391821691163384611fb9565b82156119be5781546119a49084611ff7565b82556002546119be906001600160a01b0316333086611fb9565b60028201546119cd9082611ff7565b600283015560095460035483546119e99291610ab59190611f39565b6001830155600a546119fb9084611ff7565b600a55600c54611a0b9084611ff7565b600c5560408051848152602081018390527fa3af609bf46297028ce551832669030f9effef2b02606d02cbbcc40fe6b47c559101610b94565b600060118281548110611a5957611a596126c7565b9060005260206000209060060201600301549050919050565b60026001541415611a955760405162461bcd60e51b815260040161067f906124f3565b60026001908155336000908152600e60205260408120805482825592810191909155908015611ad557600254611ad5906001600160a01b03163383611f51565b81546040519081527f99d7f8b71cfb9126984f7a5eed3a40e64a8959e9b0e442221546fb04ec6a489c9060200160405180910390a1505060018055565b60008060118481548110611b2857611b286126c7565b60009182526020808320878452600f825260408085206001600160a01b03891686529092529083206001810154600690930290910193509190611b759042906001600160801b0316611f26565b60048401546001840154919250611b98916001600160801b039081169116611ff7565b426001600160801b031610611cab5750600482015460018201546001600160801b0391821691611bc9911682611ff7565b6004840154600160801b90046001600160801b031611801590611bf857506005830154600160401b900460ff16155b15611c725760018201546004840154611c24916001600160801b03600160801b90920482169116611f26565b60058401548354919250611c689161271091610ab5916301e133809183916001600160401b0390911690611c62906001600160801b03891690611f39565b90611f39565b9350505050611d24565b60058301548254611c689161271091610ab5916301e133809183916001600160401b031690611c62906001600160801b03891690611f39565b6005830154600160401b900460ff16611ce55760018201546004840154611c24916001600160801b03600160801b90920482169116611f26565b60058301548254611d1e9161271091610ab5916301e133809183916001600160401b031690611c62906001600160801b03891690611f39565b93505050505b92915050565b33611d33611644565b6001600160a01b031614611d595760405162461bcd60e51b815260040161067f90612491565b6001600160a01b038116611dbe5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161067f565b610bf081612003565b6001600160a01b0381166000908152600e6020526040812081611de9600a5490565b905060065443118015611dfb57508015155b15611e82576000611e0e60065443612053565b90506000611e2760085483611f3990919063ffffffff16565b90506000611e50611e4785610ab560095486611f3990919063ffffffff16565b60035490611ff7565b9050611e778560010154610abb600954610ab5858a60000154611f3990919063ffffffff16565b979650505050505050565b611ea98260010154610abb600954610ab56003548760000154611f3990919063ffffffff16565b949350505050565b6006544311611ebc57565b6000611ec7600a5490565b905080611ed5575043600655565b6000611ee360065443612053565b90506000611efc60085483611f3990919063ffffffff16565b9050611f1a611e4784610ab560095485611f3990919063ffffffff16565b60035550504360065550565b6000611f32828461266e565b9392505050565b6000611f32828461264f565b6000611f328284612542565b6040516001600160a01b038316602482015260448101829052611fb490849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261208d565b505050565b6040516001600160a01b0380851660248301528316604482015260648101829052611ff19085906323b872dd60e01b90608401611f7d565b50505050565b6000611f32828461252a565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000600454821161206f576120688284611f26565b9050611d24565b600454831061208057506000611d24565b6004546120689084611f26565b60006120e2826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661215f9092919063ffffffff16565b805190915015611fb4578080602001905181019061210091906122c4565b611fb45760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161067f565b6060611ea98484600085856001600160a01b0385163b6121c15760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161067f565b600080866001600160a01b031685876040516121dd9190612406565b60006040518083038185875af1925050503d806000811461221a576040519150601f19603f3d011682016040523d82523d6000602084013e61221f565b606091505b5091509150611e7782828660608315612239575081611f32565b8251156122495782518084602001fd5b8160405162461bcd60e51b815260040161067f9190612436565b80356001600160a01b038116811461227a57600080fd5b919050565b60006020828403121561229157600080fd5b611f3282612263565b600080604083850312156122ad57600080fd5b6122b683612263565b946020939093013593505050565b6000602082840312156122d657600080fd5b8151611f32816126dd565b600080604083850312156122f457600080fd5b82356122b6816126dd565b60006020828403121561231157600080fd5b5035919050565b6000806040838503121561232b57600080fd5b8235915061233b60208401612263565b90509250929050565b6000806040838503121561235757600080fd5b50508035926020909101359150565b6000806000806080858703121561237c57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600080600060a086880312156123b057600080fd5b85359450602086013593506040860135925060608601356001600160401b03811681146123dc57600080fd5b915060808601356001600160801b03811681146123f857600080fd5b809150509295509295909350565b60008251612418818460208701612685565b9190910192915050565b6001600160a01b0391909116815260200190565b6020815260008251806020840152612455816040850160208701612685565b601f01601f19169190910160400192915050565b6020808252600e908201526d125b9d985b1a5908105b5bdd5b9d60921b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526013908201527221b0b63632b91034b9903737ba1030b236b4b760691b604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6000821982111561253d5761253d6126b1565b500190565b60008261255f57634e487b7160e01b600052601260045260246000fd5b500490565b600181815b8085111561259f578160001904821115612585576125856126b1565b8085161561259257918102915b93841c9390800290612569565b509250929050565b6000611f3283836000826125bd57506001611d24565b816125ca57506000611d24565b81600181146125e057600281146125ea57612606565b6001915050611d24565b60ff8411156125fb576125fb6126b1565b50506001821b611d24565b5060208310610133831016604e8410600b8410161715612629575081810a611d24565b6126338383612564565b8060001904821115612647576126476126b1565b029392505050565b6000816000190483118215151615612669576126696126b1565b500290565b600082821015612680576126806126b1565b500390565b60005b838110156126a0578181015183820152602001612688565b83811115611ff15750506000910152565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b8015158114610bf057600080fdfea2646970667358221220116a20194e25f65ccb965d284759a8a5ecfcac9cba3067740dca780dc12fe86d64736f6c6343000806003300000000000000000000000024be50e0d2ed2586001dafe8dedfde479768a86900000000000000000000000027cd006548df7c8c8e9fdc4a67fa05c2e3ca5cf9

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106102535760003560e01c806370480275116101465780639bb10d3f116100c3578063ccd34cd511610087578063ccd34cd5146105f9578063db2e21bc14610602578063e39c08fc1461060a578063f07b24921461061d578063f2fde38b14610625578063f40f0f521461063857600080fd5b80639bb10d3f146105af578063a0b40905146105b7578063a9f8d181146105ca578063b6b55f25146105d3578063c00dc47b146105e657600080fd5b80638ae39cac1161010a5780638ae39cac1461056e5780638da5cb5b146105775780638f6629151461057f57806392e8990e146105885780639513997f1461059c57600080fd5b80637048027514610518578063715018a61461052b57806372e138481461053357806380dc067214610553578063811d7a981461055b57600080fd5b8063392e53cd116101d457806360a2da441161019857806360a2da441461043957806363a846f81461044c57806366829b161461046f57806366fe9f8a1461048257806367c370fe1461048b57600080fd5b8063392e53cd146103d35780633f138d4b146103e757806348cd4cb1146103fa578063503653b8146104035780635dcc93911461041657600080fd5b80631aed65531161021b5780631aed6553146103705780631fb2dfd8146103875780632e1a7d4d1461039a5780633279beab146103ad57806337de615f146103c057600080fd5b806301f8a9761461025857806313992a1b1461026d5780631526fe27146102ae5780631785f53c146103135780631959a00214610326575b600080fd5b61026b6102663660046122ff565b61064b565b005b61029961027b36600461227f565b6001600160a01b031660009081526010602052604090205460ff1690565b60405190151581526020015b60405180910390f35b6102c16102bc3660046122ff565b6106cc565b6040805198895260208901979097529587019490945260608601929092526001600160801b0390811660808601521660a08401526001600160401b031660c0830152151560e0820152610100016102a5565b61026b61032136600461227f565b61073c565b61035561033436600461227f565b600e6020526000908152604090208054600182015460029092015490919083565b604080519384526020840192909252908201526060016102a5565b61037960045481565b6040519081526020016102a5565b61026b610395366004612398565b6107bb565b61026b6103a83660046122ff565b6109fc565b61026b6103bb3660046122ff565b610ba5565b61026b6103ce3660046122ff565b610bf3565b60025461029990600160a81b900460ff1681565b61026b6103f536600461229a565b610d1c565b61037960055481565b61026b6104113660046122ff565b610e01565b6104216301e1338081565b6040516001600160801b0390911681526020016102a5565b61026b610447366004612366565b6110b1565b61029961045a36600461227f565b60106020526000908152604090205460ff1681565b61026b61047d36600461227f565b61119e565b61037960075481565b6104e2610499366004612318565b600f602090815260009283526040808420909152908252902080546001820154600283015460039093015491926001600160801b0380831693600160801b909304169160ff1685565b604080519586526001600160801b039485166020870152929093169184019190915260608301521515608082015260a0016102a5565b61026b61052636600461227f565b611218565b61026b61129a565b600d54610546906001600160a01b031681565b6040516102a59190612422565b61026b6112d5565b61026b610569366004612344565b61130f565b61037960085481565b610546611644565b61037960035481565b60025461029990600160a01b900460ff1681565b61026b6105aa366004612344565b611653565b600a54610379565b61026b6105c53660046122e1565b61179a565b61037960065481565b61026b6105e13660046122ff565b611891565b6103796105f43660046122ff565b611a44565b61037960095481565b61026b611a72565b610379610618366004612318565b611b12565b600c54610379565b61026b61063336600461227f565b611d2a565b61037961064636600461227f565b611dc7565b3360009081526010602052604090205460ff1615156001146106885760405162461bcd60e51b815260040161067f906124c6565b60405180910390fd5b610690611eb1565b60088190556040518181527f0c4d677eef92893ac7ec52faf8140fc6c851ab4736302b4f3a89dfb20696a0df906020015b60405180910390a150565b601181815481106106dc57600080fd5b6000918252602090912060069091020180546001820154600283015460038401546004850154600590950154939550919390926001600160801b0380831692600160801b900416906001600160401b03811690600160401b900460ff1688565b33610745611644565b6001600160a01b03161461076b5760405162461bcd60e51b815260040161067f90612491565b6001600160a01b03811660009081526010602052604090819020805460ff19169055517f753f40ca3312b2408759a67875b367955e7baa221daf08aa3d643d96202ac12b906106c1908390612422565b3360009081526010602052604090205460ff1615156001146107ef5760405162461bcd60e51b815260040161067f906124c6565b6040805161010081018252868152602081018681529181018581526000606083018181526001600160801b038087166080860190815260a086018481526001600160401b03808b1660c08901908152600160e08a01818152601180548084018255818b529b516006909c027f31ecc21a745e3968a04e9570e4425bc18fa8019c68028196b546d1669c200c6881019c909c559b517f31ecc21a745e3968a04e9570e4425bc18fa8019c68028196b546d1669c200c698c015598517f31ecc21a745e3968a04e9570e4425bc18fa8019c68028196b546d1669c200c6a8b015595517f31ecc21a745e3968a04e9570e4425bc18fa8019c68028196b546d1669c200c6b8a0155925191518416600160801b0291909316177f31ecc21a745e3968a04e9570e4425bc18fa8019c68028196b546d1669c200c6c870155517f31ecc21a745e3968a04e9570e4425bc18fa8019c68028196b546d1669c200c6d909501805494511515600160401b0268ffffffffffffffffff19909516959091169490941792909217909255915490916109849190611f26565b604080518281526020810189905290810187905260006060820152608081018690526001600160401b03851660a08201526001600160801b03841660c08201529091507fd98a31fab58d7aa359be348baa21a1d70c2f7e9866815dffa79759cbfaa4d2259060e00160405180910390a1505050505050565b60026001541415610a1f5760405162461bcd60e51b815260040161067f906124f3565b6002600155336000908152600e602052604090208054821115610a845760405162461bcd60e51b815260206004820152601b60248201527f416d6f756e7420746f20776974686472617720746f6f20686967680000000000604482015260640161067f565b610a8c611eb1565b6000610ac18260010154610abb600954610ab56003548760000154611f3990919063ffffffff16565b90611f45565b90611f26565b90508215610aee578154610ad59084611f26565b8255600254610aee906001600160a01b03163385611f51565b8015610b1257600d54600254610b12916001600160a01b0391821691163384611fb9565b6002820154610b219082611ff7565b60028301556009546003548354610b3d9291610ab59190611f39565b6001830155600a54610b4f9084611f26565b600a55600c54610b5f9084611f26565b600c5560408051848152602081018390527f56ca301a9219608c91e7bcee90e083c19671d2cdcc96752c7af291cee5f9c8c891015b60405180910390a150506001805550565b3360009081526010602052604090205460ff161515600114610bd95760405162461bcd60e51b815260040161067f906124c6565b600254610bf0906001600160a01b03163383611f51565b50565b3360009081526010602052604090205460ff161515600114610c275760405162461bcd60e51b815260040161067f906124c6565b600060118281548110610c3c57610c3c6126c7565b906000526020600020906006020190508060050160089054906101000a900460ff1615156001151514610ca75760405162461bcd60e51b8152602060048201526013602482015272151a1a5cc8141bdbdb081a5cc818db1bdcd959606a1b604482015260640161067f565b60058101805460ff60401b191690556004810180546001600160801b03908116600160801b42831681029190911792839055604080518681529190930490911660208201527f11a7044d16b19253bc3b2610e57a5cbc9ac8b41fb1d0558df170493dca4c631d91015b60405180910390a15050565b3360009081526010602052604090205460ff161515600114610d505760405162461bcd60e51b815260040161067f906124c6565b6002546001600160a01b0383811691161415610dae5760405162461bcd60e51b815260206004820152601d60248201527f43616e6e6f74206265207374616b65642f72657761726420746f6b656e000000604482015260640161067f565b610dc26001600160a01b0383163383611f51565b604080516001600160a01b0384168152602081018390527f74545154aac348a3eac92596bd1971957ca94795f4e954ec5f613b55fab781299101610d10565b60026001541415610e245760405162461bcd60e51b815260040161067f906124f3565b6002600181905550600060118281548110610e4157610e416126c7565b60009182526020808320858452600f825260408085203386529092529083206001810154600690930290910193509190610e8890426001600160801b039081169116611f26565b905060008360050160089054906101000a900460ff161515600115151415610ef25760048401546001600160801b0390811690831610610eed57610ecc8533611b12565b600d54600254919250610eed916001600160a01b0390811691163384611fb9565b610f1d565b610efc8533611b12565b600d54600254919250610f1d916001600160a01b0390811691163384611fb9565b80610f3c5782546003850154610f3291611f26565b6003850155610fa0565b82546002850154610f4c91611f26565b600285015582546003850154610f6191611f26565b600385015560408051868152602081018390527fe4ef83d75d0957b32280b1d2ef8a2ea64492482f14fa43952fb008c304c34a23910160405180910390a15b8254600254610fbc916001600160a01b03909116903390611f51565b825460038401805460ff19169055610fd48180611f26565b84556002840154610fe59083611ff7565b60028501558354600c54610ff891611f26565b600c558454600386015460028701546005880154604080518b815260208101959095528401929092526060830152600160401b900460ff16151560808201527f7fc368d8322542813b2cc45a7e05a897acb9c1878f6053a78125c4e65936e5399060a00160405180910390a160408051878152602081018390529081018390527f7ce60cb683ee7d23692b92416a3edd808b8bc7d04be198d3516639a8b0509cae9060600160405180910390a150506001805550505050565b3360009081526010602052604090205460ff1615156001146110e55760405162461bcd60e51b815260040161067f906124c6565b600254600160a81b900460ff16156111355760405162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481a5b9a5d1a585b1a5e9959606a1b604482015260640161067f565b6002805460ff60a81b1916600160a81b1790556008849055600583905560048290558015611176576002805460ff60a01b1916600160a01b17905560078190555b6009611183601e82611f26565b61118e90600a6125a7565b6009555050600554600655505050565b336111a7611644565b6001600160a01b0316146111cd5760405162461bcd60e51b815260040161067f90612491565b600280546001600160a01b0319166001600160a01b0383161790556040517fa923c109999878794766ef1a56d61e2ec803c77b531bda96f8edbe09c458a32c906106c1908390612422565b33611221611644565b6001600160a01b0316146112475760405162461bcd60e51b815260040161067f90612491565b6001600160a01b03811660009081526010602052604090819020805460ff19166001179055517fad6de4452a631e641cb59902236607946ce9272b9b981f2f80e8d129cb9084ba906106c1908390612422565b336112a3611644565b6001600160a01b0316146112c95760405162461bcd60e51b815260040161067f90612491565b6112d36000612003565b565b3360009081526010602052604090205460ff1615156001146113095760405162461bcd60e51b815260040161067f906124c6565b43600455565b600260015414156113325760405162461bcd60e51b815260040161067f906124f3565b600260018190555060006011838154811061134f5761134f6126c7565b60009182526020808320868452600f8252604080852033865290925290832080546006909302909101935091906113869085611ff7565b6005840154909150600160401b900460ff166113d95760405162461bcd60e51b81526020600482015260126024820152715468697320706f6f6c20697320636c6f736560701b604482015260640161067f565b600382015460ff16156114205760405162461bcd60e51b815260206004820152600f60248201526e596f7520617265205374616b696e6760881b604482015260640161067f565b600084116114405760405162461bcd60e51b815260040161067f90612469565b82548110801590611455575082600101548111155b6114715760405162461bcd60e51b815260040161067f90612469565b600283015460038401546114859086611ff7565b11156114bc5760405162461bcd60e51b815260040161067f90602080825260049082015263119d5b1b60e21b604082015260600190565b6002546114d4906001600160a01b0316333087611fb9565b81546114e09085611ff7565b82556001820180546001600160801b031916426001600160801b031617905560118054611543919087908110611518576115186126c7565b600091825260209091206004600690920201015460018401546001600160801b039081169116611ff7565b600180840180546001600160801b03938416600160801b029316929092179091556003808401805460ff19169092179091558301546115829085611ff7565b6003840155600c546115949085611ff7565b600c558254600384015460028501546005860154604080518a815260208101959095528401929092526060830152600160401b900460ff16151560808201527f7fc368d8322542813b2cc45a7e05a897acb9c1878f6053a78125c4e65936e5399060a00160405180910390a160408051868152602081018690527fe1331ce3f664fb73189b50ae3df3a60a4a3ff376c058b74b21d3297187195f1d910160405180910390a1505060018055505050565b6000546001600160a01b031690565b3360009081526010602052604090205460ff1615156001146116875760405162461bcd60e51b815260040161067f906124c6565b8082106116ed5760405162461bcd60e51b815260206004820152602e60248201527f4e6577207374617274426c6f636b206d757374206265206c6f7765722074686160448201526d6e206e657720656e64426c6f636b60901b606482015260840161067f565b8143106117555760405162461bcd60e51b815260206004820152603060248201527f4e6577207374617274426c6f636b206d7573742062652068696768657220746860448201526f616e2063757272656e7420626c6f636b60801b606482015260840161067f565b60058290556004819055600682905560408051838152602081018390527f7cd0ab87d19036f3dfadadb232c78aa4879dda3f0c994a9d637532410ee2ce069101610d10565b3360009081526010602052604090205460ff1615156001146117ce5760405162461bcd60e51b815260040161067f906124c6565b81156118415760075481116118205760405162461bcd60e51b81526020600482015260186024820152772732bb903634b6b4ba1036bab9ba103132903434b3b432b960411b604482015260640161067f565b60078190556002805460ff60a01b1916600160a01b8415150217905561185e565b6002805460ff60a01b1916600160a01b8415150217905560006007555b7f241f67ee5f41b7a5cabf911367329be7215900f602ebfc47f89dce2a6bcd847c600754604051610d1091815260200190565b600260015414156118b45760405162461bcd60e51b815260040161067f906124f3565b60026001819055336000908152600e602052604090209054600160a01b900460ff16156119335760075481546118eb908490611ff7565b11156119335760405162461bcd60e51b8152602060048201526017602482015276155cd95c88185b5bdd5b9d0818589bdd99481b1a5b5a5d604a1b604482015260640161067f565b61193b611eb1565b8054600090156119925761196c8260010154610abb600954610ab56003548760000154611f3990919063ffffffff16565b9050801561199257600d54600254611992916001600160a01b0391821691163384611fb9565b82156119be5781546119a49084611ff7565b82556002546119be906001600160a01b0316333086611fb9565b60028201546119cd9082611ff7565b600283015560095460035483546119e99291610ab59190611f39565b6001830155600a546119fb9084611ff7565b600a55600c54611a0b9084611ff7565b600c5560408051848152602081018390527fa3af609bf46297028ce551832669030f9effef2b02606d02cbbcc40fe6b47c559101610b94565b600060118281548110611a5957611a596126c7565b9060005260206000209060060201600301549050919050565b60026001541415611a955760405162461bcd60e51b815260040161067f906124f3565b60026001908155336000908152600e60205260408120805482825592810191909155908015611ad557600254611ad5906001600160a01b03163383611f51565b81546040519081527f99d7f8b71cfb9126984f7a5eed3a40e64a8959e9b0e442221546fb04ec6a489c9060200160405180910390a1505060018055565b60008060118481548110611b2857611b286126c7565b60009182526020808320878452600f825260408085206001600160a01b03891686529092529083206001810154600690930290910193509190611b759042906001600160801b0316611f26565b60048401546001840154919250611b98916001600160801b039081169116611ff7565b426001600160801b031610611cab5750600482015460018201546001600160801b0391821691611bc9911682611ff7565b6004840154600160801b90046001600160801b031611801590611bf857506005830154600160401b900460ff16155b15611c725760018201546004840154611c24916001600160801b03600160801b90920482169116611f26565b60058401548354919250611c689161271091610ab5916301e133809183916001600160401b0390911690611c62906001600160801b03891690611f39565b90611f39565b9350505050611d24565b60058301548254611c689161271091610ab5916301e133809183916001600160401b031690611c62906001600160801b03891690611f39565b6005830154600160401b900460ff16611ce55760018201546004840154611c24916001600160801b03600160801b90920482169116611f26565b60058301548254611d1e9161271091610ab5916301e133809183916001600160401b031690611c62906001600160801b03891690611f39565b93505050505b92915050565b33611d33611644565b6001600160a01b031614611d595760405162461bcd60e51b815260040161067f90612491565b6001600160a01b038116611dbe5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161067f565b610bf081612003565b6001600160a01b0381166000908152600e6020526040812081611de9600a5490565b905060065443118015611dfb57508015155b15611e82576000611e0e60065443612053565b90506000611e2760085483611f3990919063ffffffff16565b90506000611e50611e4785610ab560095486611f3990919063ffffffff16565b60035490611ff7565b9050611e778560010154610abb600954610ab5858a60000154611f3990919063ffffffff16565b979650505050505050565b611ea98260010154610abb600954610ab56003548760000154611f3990919063ffffffff16565b949350505050565b6006544311611ebc57565b6000611ec7600a5490565b905080611ed5575043600655565b6000611ee360065443612053565b90506000611efc60085483611f3990919063ffffffff16565b9050611f1a611e4784610ab560095485611f3990919063ffffffff16565b60035550504360065550565b6000611f32828461266e565b9392505050565b6000611f32828461264f565b6000611f328284612542565b6040516001600160a01b038316602482015260448101829052611fb490849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261208d565b505050565b6040516001600160a01b0380851660248301528316604482015260648101829052611ff19085906323b872dd60e01b90608401611f7d565b50505050565b6000611f32828461252a565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000600454821161206f576120688284611f26565b9050611d24565b600454831061208057506000611d24565b6004546120689084611f26565b60006120e2826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661215f9092919063ffffffff16565b805190915015611fb4578080602001905181019061210091906122c4565b611fb45760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161067f565b6060611ea98484600085856001600160a01b0385163b6121c15760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161067f565b600080866001600160a01b031685876040516121dd9190612406565b60006040518083038185875af1925050503d806000811461221a576040519150601f19603f3d011682016040523d82523d6000602084013e61221f565b606091505b5091509150611e7782828660608315612239575081611f32565b8251156122495782518084602001fd5b8160405162461bcd60e51b815260040161067f9190612436565b80356001600160a01b038116811461227a57600080fd5b919050565b60006020828403121561229157600080fd5b611f3282612263565b600080604083850312156122ad57600080fd5b6122b683612263565b946020939093013593505050565b6000602082840312156122d657600080fd5b8151611f32816126dd565b600080604083850312156122f457600080fd5b82356122b6816126dd565b60006020828403121561231157600080fd5b5035919050565b6000806040838503121561232b57600080fd5b8235915061233b60208401612263565b90509250929050565b6000806040838503121561235757600080fd5b50508035926020909101359150565b6000806000806080858703121561237c57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600080600060a086880312156123b057600080fd5b85359450602086013593506040860135925060608601356001600160401b03811681146123dc57600080fd5b915060808601356001600160801b03811681146123f857600080fd5b809150509295509295909350565b60008251612418818460208701612685565b9190910192915050565b6001600160a01b0391909116815260200190565b6020815260008251806020840152612455816040850160208701612685565b601f01601f19169190910160400192915050565b6020808252600e908201526d125b9d985b1a5908105b5bdd5b9d60921b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526013908201527221b0b63632b91034b9903737ba1030b236b4b760691b604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6000821982111561253d5761253d6126b1565b500190565b60008261255f57634e487b7160e01b600052601260045260246000fd5b500490565b600181815b8085111561259f578160001904821115612585576125856126b1565b8085161561259257918102915b93841c9390800290612569565b509250929050565b6000611f3283836000826125bd57506001611d24565b816125ca57506000611d24565b81600181146125e057600281146125ea57612606565b6001915050611d24565b60ff8411156125fb576125fb6126b1565b50506001821b611d24565b5060208310610133831016604e8410600b8410161715612629575081810a611d24565b6126338383612564565b8060001904821115612647576126476126b1565b029392505050565b6000816000190483118215151615612669576126696126b1565b500290565b600082821015612680576126806126b1565b500390565b60005b838110156126a0578181015183820152602001612688565b83811115611ff15750506000910152565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b8015158114610bf057600080fdfea2646970667358221220116a20194e25f65ccb965d284759a8a5ecfcac9cba3067740dca780dc12fe86d64736f6c63430008060033