ETH Price: $3,011.05 (+2.91%)

Contract

0x1F10D95D34474c09f98A0ceDe97337F9A63D9793
 

Overview

ETH Balance

0 ETH

ETH Value

$0.00

Token Holdings

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To
Stop Reward23220662024-04-18 15:25:47649 days ago1713453947IN
0x1F10D95D...9A63D9793
0 ETH0.000024590.0008856
Emergency Reward...23218272024-04-18 15:17:49649 days ago1713453469IN
0x1F10D95D...9A63D9793
0 ETH0.000031810.00100396
Withdraw23190682024-04-18 13:45:51649 days ago1713447951IN
0x1F10D95D...9A63D9793
0 ETH0.000023790.0009703
Withdraw23190512024-04-18 13:45:17649 days ago1713447917IN
0x1F10D95D...9A63D9793
0 ETH0.000024650.00096943
Withdraw23189022024-04-18 13:40:19649 days ago1713447619IN
0x1F10D95D...9A63D9793
0 ETH0.000023150.00091296
Withdraw23188972024-04-18 13:40:09649 days ago1713447609IN
0x1F10D95D...9A63D9793
0 ETH0.000023330.00094119
Withdraw23187942024-04-18 13:36:43649 days ago1713447403IN
0x1F10D95D...9A63D9793
0 ETH0.000018290.00116434
Create Deposit23167882024-04-18 12:29:51649 days ago1713443391IN
0x1F10D95D...9A63D9793
0 ETH0.000021730.00094118
Add To Deposit23167492024-04-18 12:28:33649 days ago1713443313IN
0x1F10D95D...9A63D9793
0 ETH0.000022350.00091295
Create Deposit23078072024-04-18 7:30:29649 days ago1713425429IN
0x1F10D95D...9A63D9793
0 ETH0.000015030.00094118
Claim Reward22775242024-04-17 14:41:03650 days ago1713364863IN
0x1F10D95D...9A63D9793
0 ETH0.00005770.00088532
Create Deposit22746772024-04-17 13:06:09650 days ago1713359169IN
0x1F10D95D...9A63D9793
0 ETH0.000061510.0007375
Create Deposit22691402024-04-17 10:01:35650 days ago1713348095IN
0x1F10D95D...9A63D9793
0 ETH0.000025140.00094119
Withdraw22690642024-04-17 9:59:03650 days ago1713347943IN
0x1F10D95D...9A63D9793
0 ETH0.000022330.00091215
Create Deposit22689362024-04-17 9:54:47650 days ago1713347687IN
0x1F10D95D...9A63D9793
0 ETH0.000026240.00089412
Create Deposit22668832024-04-17 8:46:21650 days ago1713343581IN
0x1F10D95D...9A63D9793
0 ETH0.000021060.001067
Create Deposit22326612024-04-16 13:45:37651 days ago1713275137IN
0x1F10D95D...9A63D9793
0 ETH0.000022770.0009703

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Block From To
22325082024-04-16 13:40:31651 days ago1713274831  Contract Creation0 ETH

Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
LpAlphaPoolInitializable

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
Yes with 1 runs

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

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";

import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";

contract LpAlphaPoolInitializable is Ownable, ReentrancyGuard {
    using SafeERC20 for IERC20Metadata;
    using EnumerableSet for EnumerableSet.UintSet;

    // The address of the smart alpha pool factory
    address public LP_ALPHA_POOL_FACTORY;

    // Whether a limit is set for users
    bool public hasUserLimit;

    // Whether it is initialized
    bool public isInitialized;

    // Accrued token per share
    uint256 public accTokenPerShare;

    // The block number when reward mining ends.
    uint256 public bonusEndBlock;

    // The block number when reward mining starts.
    uint256 public startBlock;

    // The block number of the last pool update
    uint256 public lastRewardBlock;

    // The pool limit (0 if none)
    uint256 public poolLimitPerUser;

    // reward tokens created per block.
    uint256 public rewardPerBlock;

    // The precision factor
    uint256 public PRECISION_FACTOR;
    uint256 public MULTIPLIER_FACTOR = 10000;

    // The reward token
    IERC20Metadata public rewardToken;

    // The staked token
    IERC20Metadata public stakedToken;

    uint256 public maxLockTime;
    uint256 public minLockTime;
    uint256 public maxBoostingMultiplier;

    uint256 public totalStaked;
    uint256 public virtualTotalStaked;

    // Info of each user that stakes tokens (stakedToken)
    DepositInfo[] public depositInfo;
    mapping(address => EnumerableSet.UintSet) private userStakes;

    mapping(address => UserInfo) public userInfo;

    struct DepositInfo {
        uint256 depositId;
        address owner;
        uint256 amount; // How many staked tokens the user has provided
        uint256 virtualAmount; // Boosted amount
        uint256 lockUntil; // Lock until timestamp
    }

    struct UserInfo {
        uint256 amount;
        uint256 virtualAmount;
        uint256 rewardDebt;
    }

    struct PoolInfo {
        address _poolAddress;
        IERC20Metadata _stakedToken;
        IERC20Metadata _rewardToken;
        uint256 _rewardPerBlock;
        uint256 _startBlock;
        uint256 _bonusEndBlock;
        uint256 _poolLimitPerUser;
        uint256 _maxLockTime;
        uint256 _minLockTime;
        uint256 _maxBoostingMultiplier;
        uint256 _totalStaked;
        uint256 _virtualTotalStake;
    }

    event AdminTokenRecovery(address tokenRecovered, uint256 amount);
    event Deposit(
        address indexed user,
        uint256 depositId,
        address indexed token,
        uint256 amount,
        uint256 lockDuration,
        uint256 virtualAmount
    );
    event AddDeposit(
        address indexed user,
        uint256 depositId,
        address indexed token,
        uint256 amount,
        uint256 virtualAmount
    );
    event ExtendDeposit(
        address indexed user,
        uint256 depositId,
        address indexed token,
        uint256 extendTime,
        uint256 oldVirtualAmount,
        uint256 newVirtualAmount
    );
    event EmergencyWithdraw(address indexed user, uint256 amount);
    event NewStartAndEndBlocks(uint256 startBlock, uint256 endBlock);
    event NewRewardPerBlock(uint256 rewardPerBlock);
    event NewPoolLimit(uint256 poolLimitPerUser);
    event RewardsStop(uint256 blockNumber);
    event Withdraw(
        address indexed user,
        uint256 depositId,
        address token,
        uint256 amount,
        uint256 virtualAmount
    );

    constructor() Ownable(msg.sender) {
        LP_ALPHA_POOL_FACTORY = msg.sender;
    }

    /*
     * @notice Initialize the contract
     * @param _stakedToken: staked token address
     * @param _rewardToken: reward token address
     * @param _rewardPerBlock: reward per block (in rewardToken)
     * @param _startBlock: start block
     * @param _bonusEndBlock: end block
     * @param _poolLimitPerUser: pool limit per user in stakedToken (if any, else 0)
     * @param _admin: admin address with ownership
     */
    function initialize(
        IERC20Metadata _stakedToken,
        IERC20Metadata _rewardToken,
        uint256 _rewardPerBlock,
        uint256 _startBlock,
        uint256 _bonusEndBlock,
        uint256 _poolLimitPerUser,
        uint256 _maxlockTime,
        uint256 _minlockTime,
        uint256 _maxBoostingMultiplier,
        address _admin
    ) external {
        require(!isInitialized, "Already initialized");
        require(msg.sender == LP_ALPHA_POOL_FACTORY, "Not factory");

        // Make this contract initialized
        isInitialized = true;

        stakedToken = _stakedToken;
        rewardToken = _rewardToken;
        rewardPerBlock = _rewardPerBlock;
        startBlock = _startBlock;
        bonusEndBlock = _bonusEndBlock;
        maxLockTime = _maxlockTime;
        minLockTime = _minlockTime;
        maxBoostingMultiplier = _maxBoostingMultiplier;

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

        uint256 decimalsRewardToken = uint256(rewardToken.decimals());
        require(decimalsRewardToken < 30, "Must be inferior to 30");
        PRECISION_FACTOR = uint256(10 ** (uint256(30) - decimalsRewardToken));

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

        // Transfer ownership to the admin address who becomes owner of the contract
        transferOwnership(_admin);
    }

    function createDeposit(
        uint256 _amount,
        uint256 _duration
    ) external nonReentrant {
        require(_duration <= maxLockTime, "AlphaPool: lock time too high");
        require(_duration >= minLockTime, "AlphaPool: lock time too low");
        require(_amount > 0, "AlphaPool: amount too low");
        require(block.number < bonusEndBlock, "AlphaPool: pool closed");
        UserInfo storage _userInfo = userInfo[msg.sender];
        if (hasUserLimit) {
            require(
                _amount + _userInfo.amount <= poolLimitPerUser,
                "AlphaPool: User amount above limit"
            );
        }
        _updatePool();

        // calculate pending rewards with all the staked tokens
        uint256 pending = ((_userInfo.amount + _userInfo.virtualAmount) *
            accTokenPerShare) /
            PRECISION_FACTOR -
            _userInfo.rewardDebt;
        if (pending > 0) {
            rewardToken.safeTransfer(address(msg.sender), pending);
        }

        uint256 _virtualAmount = getVirtualAmount(_amount, _duration);
        stakedToken.safeTransferFrom(
            address(msg.sender),
            address(this),
            _amount
        );

        totalStaked = totalStaked + _amount;
        virtualTotalStaked = virtualTotalStaked + _virtualAmount;

        uint256 depositId = depositInfo.length;
        depositInfo.push(
            DepositInfo({
                depositId: depositId,
                owner: msg.sender,
                amount: _amount,
                virtualAmount: _virtualAmount,
                lockUntil: block.timestamp + _duration
            })
        );
        userStakes[msg.sender].add(depositId);
        _userInfo.amount = _userInfo.amount + _amount;
        _userInfo.virtualAmount = _userInfo.virtualAmount + _virtualAmount;
        _userInfo.rewardDebt =
            ((_userInfo.amount + _userInfo.virtualAmount) * accTokenPerShare) /
            PRECISION_FACTOR;
        emit Deposit(
            msg.sender,
            depositId,
            address(stakedToken),
            _amount,
            _duration,
            _virtualAmount
        );
    }

    /*
     * @notice Deposit staked tokens and collect reward tokens (if any)
     * @param _amount: amount to withdraw (in rewardToken)
     */
    function addToDeposit(
        uint256 _amount,
        uint256 _depositId
    ) external nonReentrant {
        require(block.number < bonusEndBlock, "AlphaPool: pool closed");
        require(_amount > 0, "AlphaPool: amount too low");
        DepositInfo storage _deposit = depositInfo[_depositId];
        require(_deposit.owner == msg.sender, "AlphaPool: not authorized");
        require(
            _deposit.lockUntil > block.timestamp + minLockTime,
            "AlphaPool: lock time too low"
        );
        UserInfo storage _userInfo = userInfo[msg.sender];
        if (hasUserLimit) {
            require(
                _amount + _userInfo.amount <= poolLimitPerUser,
                "AlphaPool: User amount above limit"
            );
        }

        _updatePool();
        // calculate pending rewards with all the staked tokens
        uint256 pending = ((_userInfo.amount + _userInfo.virtualAmount) *
            accTokenPerShare) /
            PRECISION_FACTOR -
            _userInfo.rewardDebt;
        if (pending > 0) {
            rewardToken.safeTransfer(address(msg.sender), pending);
        }

        // update deposit info
        uint256 _virtualAmount = getVirtualAmount(
            _amount,
            _deposit.lockUntil - block.timestamp
        );
        _deposit.amount = _deposit.amount + _amount;
        _deposit.virtualAmount = _deposit.virtualAmount + _virtualAmount;
        stakedToken.safeTransferFrom(
            address(msg.sender),
            address(this),
            _amount
        );

        totalStaked = totalStaked + _amount;
        virtualTotalStaked = virtualTotalStaked + _virtualAmount;

        _userInfo.amount = _userInfo.amount + _amount;
        _userInfo.virtualAmount = _userInfo.virtualAmount + _virtualAmount;
        _userInfo.rewardDebt =
            ((_userInfo.amount + _userInfo.virtualAmount) * accTokenPerShare) /
            PRECISION_FACTOR;

        emit AddDeposit(
            msg.sender,
            _depositId,
            address(stakedToken),
            _amount,
            _virtualAmount
        );
    }

    function extendDeposit(
        uint256 _depositId,
        uint256 _extendDuration
    ) external nonReentrant {
        require(block.number < bonusEndBlock, "AlphaPool: pool closed");
        DepositInfo storage _deposit = depositInfo[_depositId];
        require(_deposit.owner == msg.sender, "AlphaPool: not authorized");
        require(
            _deposit.lockUntil + _extendDuration <=
                block.timestamp + maxLockTime,
            "AlphaPool: lock time too high"
        );
        require(
            _deposit.lockUntil + _extendDuration >=
                block.timestamp + minLockTime,
            "AlphaPool: lock time too low"
        );
        UserInfo storage _userInfo = userInfo[msg.sender];

        _updatePool();
        // calculate pending rewards with all the staked tokens
        uint256 pending = ((_userInfo.amount + _userInfo.virtualAmount) *
            accTokenPerShare) /
            PRECISION_FACTOR -
            _userInfo.rewardDebt;
        if (pending > 0) {
            rewardToken.safeTransfer(address(msg.sender), pending);
        }

        uint256 _virtualAmount = getVirtualAmount(
            _deposit.amount,
            _deposit.lockUntil + _extendDuration - block.timestamp
        );
        virtualTotalStaked =
            virtualTotalStaked -
            _deposit.virtualAmount +
            _virtualAmount;

        _userInfo.virtualAmount =
            _userInfo.virtualAmount -
            _deposit.virtualAmount +
            _virtualAmount;
        uint256 oldVirtualAmount = _deposit.virtualAmount;
        _deposit.virtualAmount = _virtualAmount;
        _deposit.lockUntil = _deposit.lockUntil + _extendDuration;
        _userInfo.rewardDebt =
            ((_userInfo.amount + _userInfo.virtualAmount) * accTokenPerShare) /
            PRECISION_FACTOR;
        emit ExtendDeposit(
            msg.sender,
            _depositId,
            address(stakedToken),
            _extendDuration,
            oldVirtualAmount,
            _virtualAmount
        );
    }

    /*
     * @notice Withdraw staked tokens and collect reward tokens
     * @param _amount: amount to withdraw (in rewardToken)
     */
    function withdraw(uint256 _depositId) external nonReentrant {
        DepositInfo storage _deposit = depositInfo[_depositId];
        require(_deposit.owner == msg.sender, "AlphaPool: not authorized");
        require(
            _deposit.lockUntil < block.timestamp,
            "AlphaPool: lock time not reached"
        );
        UserInfo storage _userInfo = userInfo[msg.sender];

        _updatePool();

        uint256 pending = ((_userInfo.amount + _userInfo.virtualAmount) *
            accTokenPerShare) /
            PRECISION_FACTOR -
            _userInfo.rewardDebt;
        if (pending > 0) {
            rewardToken.safeTransfer(address(msg.sender), pending);
        }

        _userInfo.amount = _userInfo.amount - _deposit.amount;
        _userInfo.virtualAmount =
            _userInfo.virtualAmount -
            _deposit.virtualAmount;
        stakedToken.safeTransfer(address(msg.sender), _deposit.amount);
        totalStaked = totalStaked - _deposit.amount;
        virtualTotalStaked = virtualTotalStaked - _deposit.virtualAmount;

        _userInfo.rewardDebt =
            ((_userInfo.amount + _userInfo.virtualAmount) * accTokenPerShare) /
            PRECISION_FACTOR;
        uint256 amount = _deposit.amount;
        uint256 virtualAmount = _deposit.virtualAmount;
        delete depositInfo[_depositId];
        userStakes[msg.sender].remove(_depositId);

        emit Withdraw(
            msg.sender,
            _depositId,
            address(stakedToken),
            amount,
            virtualAmount
        );
    }

    function claimReward() external nonReentrant {
        UserInfo storage _userInfo = userInfo[msg.sender];
        _updatePool();
        uint256 pending = ((_userInfo.amount + _userInfo.virtualAmount) *
            accTokenPerShare) /
            PRECISION_FACTOR -
            _userInfo.rewardDebt;
        if (pending > 0) {
            rewardToken.safeTransfer(address(msg.sender), pending);
        }
        _userInfo.rewardDebt =
            ((_userInfo.amount + _userInfo.virtualAmount) * accTokenPerShare) /
            PRECISION_FACTOR;
    }

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

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

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

    /*
     * @notice Stop rewards
     * @dev Only callable by owner. Needs to be for emergency.
     */
    function emergencyRewardWithdraw(uint256 _amount) external onlyOwner {
        rewardToken.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 onlyOwner {
        require(
            _tokenAddress != address(stakedToken),
            "Cannot be staked token"
        );
        require(
            _tokenAddress != address(rewardToken),
            "Cannot be reward token"
        );

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

        emit AdminTokenRecovery(_tokenAddress, _tokenAmount);
    }

    /*
     * @notice Stop rewards
     * @dev Only callable by owner
     */
    function stopReward() external onlyOwner {
        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 onlyOwner {
        require(hasUserLimit, "Must be set");
        if (_hasUserLimit) {
            require(
                _poolLimitPerUser > poolLimitPerUser,
                "New limit must be higher"
            );
            poolLimitPerUser = _poolLimitPerUser;
        } 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 onlyOwner {
        require(block.number < startBlock, "Pool has started");
        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 onlyOwner {
        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 = totalStaked;
        if (block.number > lastRewardBlock && stakedTokenSupply != 0) {
            uint256 multiplier = _getMultiplier(lastRewardBlock, block.number);
            uint256 tokenReward = multiplier * rewardPerBlock;
            uint256 adjustedTokenPerShare = accTokenPerShare +
                ((tokenReward * PRECISION_FACTOR) /
                    (stakedTokenSupply + virtualTotalStaked));
            return
                ((user.amount + user.virtualAmount) * adjustedTokenPerShare) /
                PRECISION_FACTOR -
                user.rewardDebt;
        } else {
            return
                ((user.amount + user.virtualAmount) * accTokenPerShare) /
                PRECISION_FACTOR -
                user.rewardDebt;
        }
    }

    function getUserDeposits(
        address user
    ) external view returns (DepositInfo[] memory) {
        uint256 length = userStakes[user].length();
        DepositInfo[] memory deposits = new DepositInfo[](length);
        for (uint256 i = 0; i < length; i++) {
            deposits[i] = depositInfo[userStakes[user].at(i)];
        }
        return deposits;
    }
    /*
     * @notice Update reward variables of the given pool to be up-to-date.
     */
    function _updatePool() internal {
        if (block.number <= lastRewardBlock) {
            return;
        }
        uint256 stakedTokenSupply = totalStaked;
        if (stakedTokenSupply == 0) {
            lastRewardBlock = block.number;
            return;
        }
        uint256 multiplier = _getMultiplier(lastRewardBlock, block.number);
        uint256 tokenReward = multiplier * rewardPerBlock;
        accTokenPerShare =
            accTokenPerShare +
            (tokenReward * PRECISION_FACTOR) /
            (stakedTokenSupply + virtualTotalStaked);
        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 - _from;
        } else if (_from >= bonusEndBlock) {
            return 0;
        } else {
            return bonusEndBlock - _from;
        }
    }

    function getVirtualAmount(
        uint256 _amount,
        uint256 _duration
    ) public view returns (uint256) {
        if (
            maxLockTime == minLockTime ||
            maxBoostingMultiplier == 0 ||
            _duration == 0
        ) {
            return 0;
        }
        return
            (_amount * (_duration - minLockTime) * maxBoostingMultiplier) /
            (maxLockTime - minLockTime) /
            MULTIPLIER_FACTOR;
    }

    function getPoolInfo() external view returns (PoolInfo memory) {
        return
            PoolInfo({
                _poolAddress: address(this),
                _stakedToken: stakedToken,
                _rewardToken: rewardToken,
                _rewardPerBlock: rewardPerBlock,
                _startBlock: startBlock,
                _bonusEndBlock: bonusEndBlock,
                _poolLimitPerUser: poolLimitPerUser,
                _maxLockTime: maxLockTime,
                _minLockTime: minLockTime,
                _maxBoostingMultiplier: maxBoostingMultiplier,
                _totalStaked: totalStaked,
                _virtualTotalStake: virtualTotalStaked
            });
    }
}

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

pragma solidity ^0.8.20;

import {Context} from "../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.
 *
 * The initial owner is set to the address provided by the deployer. 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;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

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

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

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

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";

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

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

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

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

pragma solidity ^0.8.20;

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

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

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

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

pragma solidity ^0.8.20;

/**
 * @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 value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

    /**
     * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` 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 value) external returns (bool);
}

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

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../utils/Address.sol";

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

    /**
     * @dev An operation with an ERC20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

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

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

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

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

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

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

    /**
     * @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);
        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

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

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

pragma solidity ^0.8.20;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error AddressInsufficientBalance(address account);

    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedInnerCall();

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

        (bool success, ) = recipient.call{value: amount}("");
        if (!success) {
            revert FailedInnerCall();
        }
    }

    /**
     * @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 or custom error, it is bubbled
     * up by this function (like regular Solidity function calls). However, if
     * the call reverted with no returned reason, this function reverts with a
     * {FailedInnerCall} error.
     *
     * 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.
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0);
    }

    /**
     * @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`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert AddressInsufficientBalance(address(this));
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

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

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

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
     * unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {FailedInnerCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)

pragma solidity ^0.8.20;

/**
 * @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;

    /**
     * @dev Unauthorized reentrant call.
     */
    error ReentrancyGuardReentrantCall();

    constructor() {
        _status = NOT_ENTERED;
    }

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

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be NOT_ENTERED
        if (_status == ENTERED) {
            revert ReentrancyGuardReentrantCall();
        }

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

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

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

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

pragma solidity ^0.8.20;

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

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

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

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

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

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

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

                // Move the lastValue to the index where the value to delete is
                set._values[valueIndex] = lastValue;
                // Update the tracked position of the lastValue (that was just moved)
                set._positions[lastValue] = position;
            }

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

            // Delete the tracked position for the deleted slot
            delete set._positions[value];

            return true;
        } else {
            return false;
        }
    }

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

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

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

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

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

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

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

        return result;
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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

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

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

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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

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

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

        return result;
    }
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"depositId","type":"uint256"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"virtualAmount","type":"uint256"}],"name":"AddDeposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"tokenRecovered","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"AdminTokenRecovery","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"depositId","type":"uint256"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lockDuration","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"virtualAmount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EmergencyWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"depositId","type":"uint256"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"extendTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"oldVirtualAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newVirtualAmount","type":"uint256"}],"name":"ExtendDeposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"poolLimitPerUser","type":"uint256"}],"name":"NewPoolLimit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"rewardPerBlock","type":"uint256"}],"name":"NewRewardPerBlock","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"startBlock","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"endBlock","type":"uint256"}],"name":"NewStartAndEndBlocks","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"blockNumber","type":"uint256"}],"name":"RewardsStop","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"depositId","type":"uint256"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"virtualAmount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"LP_ALPHA_POOL_FACTORY","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MULTIPLIER_FACTOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRECISION_FACTOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"accTokenPerShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_depositId","type":"uint256"}],"name":"addToDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"bonusEndBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_duration","type":"uint256"}],"name":"createDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"depositInfo","outputs":[{"internalType":"uint256","name":"depositId","type":"uint256"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"virtualAmount","type":"uint256"},{"internalType":"uint256","name":"lockUntil","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"emergencyRewardWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_depositId","type":"uint256"},{"internalType":"uint256","name":"_extendDuration","type":"uint256"}],"name":"extendDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getPoolInfo","outputs":[{"components":[{"internalType":"address","name":"_poolAddress","type":"address"},{"internalType":"contract IERC20Metadata","name":"_stakedToken","type":"address"},{"internalType":"contract IERC20Metadata","name":"_rewardToken","type":"address"},{"internalType":"uint256","name":"_rewardPerBlock","type":"uint256"},{"internalType":"uint256","name":"_startBlock","type":"uint256"},{"internalType":"uint256","name":"_bonusEndBlock","type":"uint256"},{"internalType":"uint256","name":"_poolLimitPerUser","type":"uint256"},{"internalType":"uint256","name":"_maxLockTime","type":"uint256"},{"internalType":"uint256","name":"_minLockTime","type":"uint256"},{"internalType":"uint256","name":"_maxBoostingMultiplier","type":"uint256"},{"internalType":"uint256","name":"_totalStaked","type":"uint256"},{"internalType":"uint256","name":"_virtualTotalStake","type":"uint256"}],"internalType":"struct LpAlphaPoolInitializable.PoolInfo","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getUserDeposits","outputs":[{"components":[{"internalType":"uint256","name":"depositId","type":"uint256"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"virtualAmount","type":"uint256"},{"internalType":"uint256","name":"lockUntil","type":"uint256"}],"internalType":"struct LpAlphaPoolInitializable.DepositInfo[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_duration","type":"uint256"}],"name":"getVirtualAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"hasUserLimit","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20Metadata","name":"_stakedToken","type":"address"},{"internalType":"contract IERC20Metadata","name":"_rewardToken","type":"address"},{"internalType":"uint256","name":"_rewardPerBlock","type":"uint256"},{"internalType":"uint256","name":"_startBlock","type":"uint256"},{"internalType":"uint256","name":"_bonusEndBlock","type":"uint256"},{"internalType":"uint256","name":"_poolLimitPerUser","type":"uint256"},{"internalType":"uint256","name":"_maxlockTime","type":"uint256"},{"internalType":"uint256","name":"_minlockTime","type":"uint256"},{"internalType":"uint256","name":"_maxBoostingMultiplier","type":"uint256"},{"internalType":"address","name":"_admin","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isInitialized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastRewardBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxBoostingMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxLockTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minLockTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"pendingReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolLimitPerUser","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"uint256","name":"_tokenAmount","type":"uint256"}],"name":"recoverWrongTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardPerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"contract IERC20Metadata","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakedToken","outputs":[{"internalType":"contract IERC20Metadata","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"startBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stopReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_hasUserLimit","type":"bool"},{"internalType":"uint256","name":"_poolLimitPerUser","type":"uint256"}],"name":"updatePoolLimitPerUser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rewardPerBlock","type":"uint256"}],"name":"updateRewardPerBlock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_startBlock","type":"uint256"},{"internalType":"uint256","name":"_bonusEndBlock","type":"uint256"}],"name":"updateStartAndEndBlocks","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userInfo","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"virtualAmount","type":"uint256"},{"internalType":"uint256","name":"rewardDebt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"virtualTotalStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_depositId","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6080604052612710600a5534801561001657600080fd5b50338061003d57604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b61004681610062565b5060018055600280546001600160a01b031916331790556100b2565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61264380620000c26000396000f3fe608060405234801561001057600080fd5b50600436106101cd5760003560e01c806301f8a976146101d2578063084bad78146101e75780631959a002146101fa5780631aed65531461024157806323008e85146102585780632a5bf6d21461026b5780632e1a7d4d1461028b578063317d7a2b1461029e5780633279beab146102e1578063392e53cd146102f45780633d57ec01146103185780633f138d4b1461032157806348cd4cb1146103345780635ad1d7f91461033d57806360246c881461035057806366fe9f8a14610365578063715018a61461036e57806380dc06721461037657806381252b4b1461037e578063817b1cd2146103875780638ae39cac146103905780638da5cb5b146103995780638f662915146103ae57806392e8990e146103b75780639513997f146103cb578063a0b40905146103de578063a60ff766146103f1578063a9f8d181146103fa578063b0ac901814610403578063b0b0a0f21461040c578063b18e71f21461041f578063b1adef7914610432578063b88a802f14610445578063cc7a262e1461044d578063ccd34cd514610460578063d308e10e14610469578063f2fde38b14610472578063f40f0f5214610485578063f7c618c114610498575b600080fd5b6101e56101e0366004611f95565b6104ab565b005b6101e56101f5366004611fae565b610518565b610229610208366004611fe5565b60146020526000908152604090208054600182015460029092015490919083565b60405161023893929190612002565b60405180910390f35b61024a60045481565b604051908152602001610238565b61024a610266366004611fae565b6107c8565b61027e610279366004611fe5565b610846565b6040516102389190612025565b6101e5610299366004611f95565b6109c4565b6102b16102ac366004611f95565b610c65565b604080519586526001600160a01b039094166020860152928401919091526060830152608082015260a001610238565b6101e56102ef366004611f95565b610cb0565b60025461030890600160a81b900460ff1681565b6040519015158152602001610238565b61024a600a5481565b6101e561032f36600461209c565b610ccf565b61024a60055481565b6101e561034b3660046120c8565b610dd6565b610358610fdf565b6040516102389190612159565b61024a60075481565b6101e56110da565b6101e56110ee565b61024a600f5481565b61024a60105481565b61024a60085481565b6103a16110fc565b60405161023891906121fb565b61024a60035481565b60025461030890600160a01b900460ff1681565b6101e56103d9366004611fae565b61110b565b6101e56103ec36600461221d565b611247565b61024a600e5481565b61024a60065481565b61024a60115481565b6002546103a1906001600160a01b031681565b6101e561042d366004611fae565b611342565b6101e5610440366004611fae565b61161a565b6101e561189a565b600c546103a1906001600160a01b031681565b61024a60095481565b61024a600d5481565b6101e5610480366004611fe5565b611955565b61024a610493366004611fe5565b611990565b600b546103a1906001600160a01b031681565b6104b3611aa0565b60055443106104dd5760405162461bcd60e51b81526004016104d49061223b565b60405180910390fd5b60088190556040518181527f0c4d677eef92893ac7ec52faf8140fc6c851ab4736302b4f3a89dfb20696a0df9060200160405180910390a150565b610520611ad2565b60045443106105415760405162461bcd60e51b81526004016104d490612265565b600082116105615760405162461bcd60e51b81526004016104d490612295565b600060128281548110610576576105766122c8565b600091825260209091206001600590920201908101549091506001600160a01b031633146105b65760405162461bcd60e51b81526004016104d4906122de565b600e546105c39042612327565b8160040154116105e55760405162461bcd60e51b81526004016104d49061233a565b336000908152601460205260409020600254600160a01b900460ff16156106335760075481546106159086612327565b11156106335760405162461bcd60e51b81526004016104d490612370565b61063b611afc565b600081600201546009546003548460010154856000015461065c9190612327565b61066691906123b2565b61067091906123c9565b61067a91906123eb565b9050801561069957600b54610699906001600160a01b03163383611b7a565b60006106af8642866004015461026691906123eb565b90508584600201546106c19190612327565b600285015560038401546106d6908290612327565b6003850155600c546106f3906001600160a01b0316333089611bd7565b856010546107019190612327565b601055601154610712908290612327565b6011558254610722908790612327565b83556001830154610734908290612327565b600184018190556009546003548554919290916107519190612327565b61075b91906123b2565b61076591906123c9565b6002840155600c546040516001600160a01b039091169033907f7ae95bad45b4d5f159d7b7288efcaf102d932e26a42a2986e0b45020210c9b4d906107af9089908b908790612002565b60405180910390a3505050506107c460018055565b5050565b6000600e54600d5414806107dc5750600f54155b806107e5575081155b156107f257506000610840565b600a54600e54600d5461080591906123eb565b600f54600e5461081590866123eb565b61081f90876123b2565b61082991906123b2565b61083391906123c9565b61083d91906123c9565b90505b92915050565b6001600160a01b03811660009081526013602052604081206060919061086b90611c16565b90506000816001600160401b03811115610887576108876123fe565b6040519080825280602002602001820160405280156108f357816020015b6108e06040518060a001604052806000815260200160006001600160a01b031681526020016000815260200160008152602001600081525090565b8152602001906001900390816108a55790505b50905060005b828110156109bc576001600160a01b03851660009081526013602052604090206012906109269083611c20565b81548110610936576109366122c8565b60009182526020918290206040805160a08101825260059093029091018054835260018101546001600160a01b031693830193909352600283015490820152600382015460608201526004909101546080820152825183908390811061099e5761099e6122c8565b602002602001018190525080806109b490612414565b9150506108f9565b509392505050565b6109cc611ad2565b6000601282815481106109e1576109e16122c8565b600091825260209091206001600590920201908101549091506001600160a01b03163314610a215760405162461bcd60e51b81526004016104d4906122de565b42816004015410610a745760405162461bcd60e51b815260206004820181905260248201527f416c706861506f6f6c3a206c6f636b2074696d65206e6f74207265616368656460448201526064016104d4565b336000908152601460205260409020610a8b611afc565b6000816002015460095460035484600101548560000154610aac9190612327565b610ab691906123b2565b610ac091906123c9565b610aca91906123eb565b90508015610ae957600b54610ae9906001600160a01b03163383611b7a565b60028301548254610afa91906123eb565b825560038301546001830154610b1091906123eb565b60018301556002830154600c54610b34916001600160a01b03909116903390611b7a565b8260020154601054610b4691906123eb565b6010556003830154601154610b5b91906123eb565b60115560095460035460018401548454610b759190612327565b610b7f91906123b2565b610b8991906123c9565b60028084019190915583015460038401546012805487908110610bae57610bae6122c8565b6000918252602080832060059092029091018281556001810180546001600160a01b031916905560028101839055600381018390556004018290553382526013905260409020610bfe9087611c2c565b50600c54604080518881526001600160a01b03909216602083015281018390526060810182905233907f48e958c7a7678cf4af1429f561cd67752f1b42f215b49a96076b0dc3a12037f09060800160405180910390a25050505050610c6260018055565b50565b60128181548110610c7557600080fd5b6000918252602090912060059091020180546001820154600283015460038401546004909401549294506001600160a01b0390911692909185565b610cb8611aa0565b600b54610c62906001600160a01b03163383611b7a565b610cd7611aa0565b600c546001600160a01b0390811690831603610d2e5760405162461bcd60e51b815260206004820152601660248201527521b0b73737ba1031329039ba30b5b2b2103a37b5b2b760511b60448201526064016104d4565b600b546001600160a01b0390811690831603610d855760405162461bcd60e51b815260206004820152601660248201527521b0b73737ba103132903932bbb0b932103a37b5b2b760511b60448201526064016104d4565b610d996001600160a01b0383163383611b7a565b7f74545154aac348a3eac92596bd1971957ca94795f4e954ec5f613b55fab781298282604051610dca92919061242d565b60405180910390a15050565b600254600160a81b900460ff1615610e265760405162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481a5b9a5d1a585b1a5e9959606a1b60448201526064016104d4565b6002546001600160a01b03163314610e6e5760405162461bcd60e51b815260206004820152600b60248201526a4e6f7420666163746f727960a81b60448201526064016104d4565b6002805460ff60a81b1916600160a81b179055600c80546001600160a01b03808d166001600160a01b031992831617909255600b8054928c1692909116919091179055600888905560058790556004869055600d849055600e839055600f8290558415610eee576002805460ff60a01b1916600160a01b17905560078590555b600b546040805163313ce56760e01b815290516000926001600160a01b03169163313ce5679160048083019260209291908290030181865afa158015610f38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5c9190612446565b60ff169050601e8110610faa5760405162461bcd60e51b815260206004820152601660248201527504d75737420626520696e666572696f7220746f2033360541b60448201526064016104d4565b610fb581601e6123eb565b610fc090600a61254d565b600955600554600655610fd282611955565b5050505050505050505050565b61105e60405180610180016040528060006001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b031681526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b506040805161018081018252308152600c546001600160a01b039081166020830152600b5416918101919091526008546060820152600554608082015260045460a082015260075460c0820152600d5460e0820152600e54610100820152600f5461012082015260105461014082015260115461016082015290565b6110e2611aa0565b6110ec6000611c38565b565b6110f6611aa0565b43600455565b6000546001600160a01b031690565b611113611aa0565b60055443106111345760405162461bcd60e51b81526004016104d49061223b565b80821061119a5760405162461bcd60e51b815260206004820152602e60248201527f4e6577207374617274426c6f636b206d757374206265206c6f7765722074686160448201526d6e206e657720656e64426c6f636b60901b60648201526084016104d4565b8143106112025760405162461bcd60e51b815260206004820152603060248201527f4e6577207374617274426c6f636b206d7573742062652068696768657220746860448201526f616e2063757272656e7420626c6f636b60801b60648201526084016104d4565b60058290556004819055600682905560408051838152602081018390527f7cd0ab87d19036f3dfadadb232c78aa4879dda3f0c994a9d637532410ee2ce069101610dca565b61124f611aa0565b600254600160a01b900460ff166112965760405162461bcd60e51b815260206004820152600b60248201526a135d5cdd081899481cd95d60aa1b60448201526064016104d4565b81156112f25760075481116112e85760405162461bcd60e51b81526020600482015260186024820152772732bb903634b6b4ba1036bab9ba103132903434b3b432b960411b60448201526064016104d4565b600781905561130f565b6002805460ff60a01b1916600160a01b8415150217905560006007555b7f241f67ee5f41b7a5cabf911367329be7215900f602ebfc47f89dce2a6bcd847c600754604051610dca91815260200190565b61134a611ad2565b600d5481111561136c5760405162461bcd60e51b81526004016104d490612559565b600e5481101561138e5760405162461bcd60e51b81526004016104d49061233a565b600082116113ae5760405162461bcd60e51b81526004016104d490612295565b60045443106113cf5760405162461bcd60e51b81526004016104d490612265565b336000908152601460205260409020600254600160a01b900460ff161561141d5760075481546113ff9085612327565b111561141d5760405162461bcd60e51b81526004016104d490612370565b611425611afc565b60008160020154600954600354846001015485600001546114469190612327565b61145091906123b2565b61145a91906123c9565b61146491906123eb565b9050801561148357600b54611483906001600160a01b03163383611b7a565b600061148f85856107c8565b600c549091506114aa906001600160a01b0316333088611bd7565b846010546114b89190612327565b6010556011546114c9908290612327565b601155601280546040805160a08101825282815233602082015290810188905260608101849052909190608081016115018842612327565b90528154600180820184556000938452602080852084516005909402019283558381015191830180546001600160a01b0319166001600160a01b039093169290921790915560408084015160028401556060840151600384015560809093015160049092019190915533835260139052902061157d9082611c88565b50835461158b908790612327565b8455600184015461159d908390612327565b600185018190556009546003548654919290916115ba9190612327565b6115c491906123b2565b6115ce91906123c9565b6002850155600c546040516001600160a01b039091169033907f7f30f7ade10235024f1854ad696cbe0694c0a4b2cbb8ac220da62b3d267326c2906107af9085908b908b908990612590565b611622611ad2565b60045443106116435760405162461bcd60e51b81526004016104d490612265565b600060128381548110611658576116586122c8565b600091825260209091206001600590920201908101549091506001600160a01b031633146116985760405162461bcd60e51b81526004016104d4906122de565b600d546116a59042612327565b8282600401546116b59190612327565b11156116d35760405162461bcd60e51b81526004016104d490612559565b600e546116e09042612327565b8282600401546116f09190612327565b101561170e5760405162461bcd60e51b81526004016104d49061233a565b336000908152601460205260409020611725611afc565b60008160020154600954600354846001015485600001546117469190612327565b61175091906123b2565b61175a91906123c9565b61176491906123eb565b9050801561178357600b54611783906001600160a01b03163383611b7a565b60006117a884600201544287876004015461179e9190612327565b61026691906123eb565b90508084600301546011546117bd91906123eb565b6117c79190612327565b6011556003840154600184015482916117df916123eb565b6117e99190612327565b6001840155600384018054908290556004850154611808908790612327565b6004860155600954600354600186015486546118249190612327565b61182e91906123b2565b61183891906123c9565b6002850155600c546040516001600160a01b039091169033907fa52e98af98f353eed9469e7910c049b65ad8f546c2a253afa9dda04506caa59290611884908b908b9087908990612590565b60405180910390a350505050506107c460018055565b6118a2611ad2565b3360009081526014602052604090206118b9611afc565b60008160020154600954600354846001015485600001546118da9190612327565b6118e491906123b2565b6118ee91906123c9565b6118f891906123eb565b9050801561191757600b54611917906001600160a01b03163383611b7a565b6009546003546001840154845461192e9190612327565b61193891906123b2565b61194291906123c9565b826002018190555050506110ec60018055565b61195d611aa0565b6001600160a01b038116611987576000604051631e4fbdf760e01b81526004016104d491906121fb565b610c6281611c38565b6001600160a01b0381166000908152601460205260408120601054600654431180156119bb57508015155b15611a5e5760006119ce60065443611c94565b90506000600854826119e091906123b2565b90506000601154846119f29190612327565b6009546119ff90846123b2565b611a0991906123c9565b600354611a169190612327565b905084600201546009548287600101548860000154611a359190612327565b611a3f91906123b2565b611a4991906123c9565b611a5391906123eb565b979650505050505050565b600282015460095460035460018501548554611a7a9190612327565b611a8491906123b2565b611a8e91906123c9565b611a9891906123eb565b949350505050565b33611aa96110fc565b6001600160a01b0316146110ec573360405163118cdaa760e01b81526004016104d491906121fb565b600260015403611af557604051633ee5aeb560e01b815260040160405180910390fd5b6002600155565b6006544311611b0757565b6010546000819003611b1a575043600655565b6000611b2860065443611c94565b9050600060085482611b3a91906123b2565b905060115483611b4a9190612327565b600954611b5790836123b2565b611b6191906123c9565b600354611b6e9190612327565b60035550504360065550565b611bd283846001600160a01b031663a9059cbb8585604051602401611ba092919061242d565b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050611ccf565b505050565b6040516001600160a01b038481166024830152838116604483015260648201839052611c109186918216906323b872dd90608401611ba0565b50505050565b6000610840825490565b600061083d8383611d29565b600061083d8383611d53565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600061083d8383611e46565b60006004548211611cb057611ca983836123eb565b9050610840565b6004548310611cc157506000610840565b82600454611ca991906123eb565b6000611ce46001600160a01b03841683611e95565b90508051600014158015611d09575080806020019051810190611d0791906125ab565b155b15611bd25782604051635274afe760e01b81526004016104d491906121fb565b6000826000018281548110611d4057611d406122c8565b9060005260206000200154905092915050565b60008181526001830160205260408120548015611e3c576000611d776001836123eb565b8554909150600090611d8b906001906123eb565b9050808214611df0576000866000018281548110611dab57611dab6122c8565b9060005260206000200154905080876000018481548110611dce57611dce6122c8565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080611e0157611e016125c8565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610840565b6000915050610840565b6000818152600183016020526040812054611e8d57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610840565b506000610840565b606061083d8383600084600080856001600160a01b03168486604051611ebb91906125de565b60006040518083038185875af1925050503d8060008114611ef8576040519150601f19603f3d011682016040523d82523d6000602084013e611efd565b606091505b5091509150611f0d868383611f19565b925050505b9392505050565b606082611f2e57611f2982611f6c565b611f12565b8151158015611f4557506001600160a01b0384163b155b15611f655783604051639996b31560e01b81526004016104d491906121fb565b5080611f12565b805115611f7c5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b600060208284031215611fa757600080fd5b5035919050565b60008060408385031215611fc157600080fd5b50508035926020909101359150565b6001600160a01b0381168114610c6257600080fd5b600060208284031215611ff757600080fd5b8135611f1281611fd0565b9283526020830191909152604082015260600190565b6001600160a01b03169052565b602080825282518282018190526000919060409081850190868401855b8281101561208f57815180518552868101516001600160a01b0316878601528581015186860152606080820151908601526080908101519085015260a09093019290850190600101612042565b5091979650505050505050565b600080604083850312156120af57600080fd5b82356120ba81611fd0565b946020939093013593505050565b6000806000806000806000806000806101408b8d0312156120e857600080fd5b8a356120f381611fd0565b995060208b013561210381611fd0565b985060408b0135975060608b0135965060808b0135955060a08b0135945060c08b0135935060e08b013592506101008b013591506101208b013561214681611fd0565b809150509295989b9194979a5092959850565b60006101808201905061216d828451612018565b602083015161217f6020840182612018565b5060408301516121926040840182612018565b50606083015160608301526080830151608083015260a083015160a083015260c083015160c083015260e083015160e083015261010080840151818401525061012080840151818401525061014080840151818401525061016080840151818401525092915050565b6001600160a01b0391909116815260200190565b8015158114610c6257600080fd5b6000806040838503121561223057600080fd5b82356120ba8161220f565b60208082526010908201526f141bdbdb081a185cc81cdd185c9d195960821b604082015260600190565b602080825260169082015275105b1c1a18541bdbdb0e881c1bdbdb0818db1bdcd95960521b604082015260600190565b602080825260199082015278416c706861506f6f6c3a20616d6f756e7420746f6f206c6f7760381b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b602080825260199082015278105b1c1a18541bdbdb0e881b9bdd08185d5d1a1bdc9a5e9959603a1b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b8082018082111561084057610840612311565b6020808252601c908201527b416c706861506f6f6c3a206c6f636b2074696d6520746f6f206c6f7760201b604082015260600190565b60208082526022908201527f416c706861506f6f6c3a205573657220616d6f756e742061626f7665206c696d6040820152611a5d60f21b606082015260800190565b808202811582820484141761084057610840612311565b6000826123e657634e487b7160e01b600052601260045260246000fd5b500490565b8181038181111561084057610840612311565b634e487b7160e01b600052604160045260246000fd5b60006001820161242657612426612311565b5060010190565b6001600160a01b03929092168252602082015260400190565b60006020828403121561245857600080fd5b815160ff81168114611f1257600080fd5b600181815b808511156124a457816000190482111561248a5761248a612311565b8085161561249757918102915b93841c939080029061246e565b509250929050565b6000826124bb57506001610840565b816124c857506000610840565b81600181146124de57600281146124e857612504565b6001915050610840565b60ff8411156124f9576124f9612311565b50506001821b610840565b5060208310610133831016604e8410600b8410161715612527575081810a610840565b6125318383612469565b806000190482111561254557612545612311565b029392505050565b600061083d83836124ac565b6020808252601d908201527f416c706861506f6f6c3a206c6f636b2074696d6520746f6f2068696768000000604082015260600190565b93845260208401929092526040830152606082015260800190565b6000602082840312156125bd57600080fd5b8151611f128161220f565b634e487b7160e01b600052603160045260246000fd5b6000825160005b818110156125ff57602081860181015185830152016125e5565b50600092019182525091905056fea26469706673582212201cb3a893b062483fe324b6bbe6a573f1eeae7e3013586ef9a9e238646bea74ae64736f6c63430008140033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101cd5760003560e01c806301f8a976146101d2578063084bad78146101e75780631959a002146101fa5780631aed65531461024157806323008e85146102585780632a5bf6d21461026b5780632e1a7d4d1461028b578063317d7a2b1461029e5780633279beab146102e1578063392e53cd146102f45780633d57ec01146103185780633f138d4b1461032157806348cd4cb1146103345780635ad1d7f91461033d57806360246c881461035057806366fe9f8a14610365578063715018a61461036e57806380dc06721461037657806381252b4b1461037e578063817b1cd2146103875780638ae39cac146103905780638da5cb5b146103995780638f662915146103ae57806392e8990e146103b75780639513997f146103cb578063a0b40905146103de578063a60ff766146103f1578063a9f8d181146103fa578063b0ac901814610403578063b0b0a0f21461040c578063b18e71f21461041f578063b1adef7914610432578063b88a802f14610445578063cc7a262e1461044d578063ccd34cd514610460578063d308e10e14610469578063f2fde38b14610472578063f40f0f5214610485578063f7c618c114610498575b600080fd5b6101e56101e0366004611f95565b6104ab565b005b6101e56101f5366004611fae565b610518565b610229610208366004611fe5565b60146020526000908152604090208054600182015460029092015490919083565b60405161023893929190612002565b60405180910390f35b61024a60045481565b604051908152602001610238565b61024a610266366004611fae565b6107c8565b61027e610279366004611fe5565b610846565b6040516102389190612025565b6101e5610299366004611f95565b6109c4565b6102b16102ac366004611f95565b610c65565b604080519586526001600160a01b039094166020860152928401919091526060830152608082015260a001610238565b6101e56102ef366004611f95565b610cb0565b60025461030890600160a81b900460ff1681565b6040519015158152602001610238565b61024a600a5481565b6101e561032f36600461209c565b610ccf565b61024a60055481565b6101e561034b3660046120c8565b610dd6565b610358610fdf565b6040516102389190612159565b61024a60075481565b6101e56110da565b6101e56110ee565b61024a600f5481565b61024a60105481565b61024a60085481565b6103a16110fc565b60405161023891906121fb565b61024a60035481565b60025461030890600160a01b900460ff1681565b6101e56103d9366004611fae565b61110b565b6101e56103ec36600461221d565b611247565b61024a600e5481565b61024a60065481565b61024a60115481565b6002546103a1906001600160a01b031681565b6101e561042d366004611fae565b611342565b6101e5610440366004611fae565b61161a565b6101e561189a565b600c546103a1906001600160a01b031681565b61024a60095481565b61024a600d5481565b6101e5610480366004611fe5565b611955565b61024a610493366004611fe5565b611990565b600b546103a1906001600160a01b031681565b6104b3611aa0565b60055443106104dd5760405162461bcd60e51b81526004016104d49061223b565b60405180910390fd5b60088190556040518181527f0c4d677eef92893ac7ec52faf8140fc6c851ab4736302b4f3a89dfb20696a0df9060200160405180910390a150565b610520611ad2565b60045443106105415760405162461bcd60e51b81526004016104d490612265565b600082116105615760405162461bcd60e51b81526004016104d490612295565b600060128281548110610576576105766122c8565b600091825260209091206001600590920201908101549091506001600160a01b031633146105b65760405162461bcd60e51b81526004016104d4906122de565b600e546105c39042612327565b8160040154116105e55760405162461bcd60e51b81526004016104d49061233a565b336000908152601460205260409020600254600160a01b900460ff16156106335760075481546106159086612327565b11156106335760405162461bcd60e51b81526004016104d490612370565b61063b611afc565b600081600201546009546003548460010154856000015461065c9190612327565b61066691906123b2565b61067091906123c9565b61067a91906123eb565b9050801561069957600b54610699906001600160a01b03163383611b7a565b60006106af8642866004015461026691906123eb565b90508584600201546106c19190612327565b600285015560038401546106d6908290612327565b6003850155600c546106f3906001600160a01b0316333089611bd7565b856010546107019190612327565b601055601154610712908290612327565b6011558254610722908790612327565b83556001830154610734908290612327565b600184018190556009546003548554919290916107519190612327565b61075b91906123b2565b61076591906123c9565b6002840155600c546040516001600160a01b039091169033907f7ae95bad45b4d5f159d7b7288efcaf102d932e26a42a2986e0b45020210c9b4d906107af9089908b908790612002565b60405180910390a3505050506107c460018055565b5050565b6000600e54600d5414806107dc5750600f54155b806107e5575081155b156107f257506000610840565b600a54600e54600d5461080591906123eb565b600f54600e5461081590866123eb565b61081f90876123b2565b61082991906123b2565b61083391906123c9565b61083d91906123c9565b90505b92915050565b6001600160a01b03811660009081526013602052604081206060919061086b90611c16565b90506000816001600160401b03811115610887576108876123fe565b6040519080825280602002602001820160405280156108f357816020015b6108e06040518060a001604052806000815260200160006001600160a01b031681526020016000815260200160008152602001600081525090565b8152602001906001900390816108a55790505b50905060005b828110156109bc576001600160a01b03851660009081526013602052604090206012906109269083611c20565b81548110610936576109366122c8565b60009182526020918290206040805160a08101825260059093029091018054835260018101546001600160a01b031693830193909352600283015490820152600382015460608201526004909101546080820152825183908390811061099e5761099e6122c8565b602002602001018190525080806109b490612414565b9150506108f9565b509392505050565b6109cc611ad2565b6000601282815481106109e1576109e16122c8565b600091825260209091206001600590920201908101549091506001600160a01b03163314610a215760405162461bcd60e51b81526004016104d4906122de565b42816004015410610a745760405162461bcd60e51b815260206004820181905260248201527f416c706861506f6f6c3a206c6f636b2074696d65206e6f74207265616368656460448201526064016104d4565b336000908152601460205260409020610a8b611afc565b6000816002015460095460035484600101548560000154610aac9190612327565b610ab691906123b2565b610ac091906123c9565b610aca91906123eb565b90508015610ae957600b54610ae9906001600160a01b03163383611b7a565b60028301548254610afa91906123eb565b825560038301546001830154610b1091906123eb565b60018301556002830154600c54610b34916001600160a01b03909116903390611b7a565b8260020154601054610b4691906123eb565b6010556003830154601154610b5b91906123eb565b60115560095460035460018401548454610b759190612327565b610b7f91906123b2565b610b8991906123c9565b60028084019190915583015460038401546012805487908110610bae57610bae6122c8565b6000918252602080832060059092029091018281556001810180546001600160a01b031916905560028101839055600381018390556004018290553382526013905260409020610bfe9087611c2c565b50600c54604080518881526001600160a01b03909216602083015281018390526060810182905233907f48e958c7a7678cf4af1429f561cd67752f1b42f215b49a96076b0dc3a12037f09060800160405180910390a25050505050610c6260018055565b50565b60128181548110610c7557600080fd5b6000918252602090912060059091020180546001820154600283015460038401546004909401549294506001600160a01b0390911692909185565b610cb8611aa0565b600b54610c62906001600160a01b03163383611b7a565b610cd7611aa0565b600c546001600160a01b0390811690831603610d2e5760405162461bcd60e51b815260206004820152601660248201527521b0b73737ba1031329039ba30b5b2b2103a37b5b2b760511b60448201526064016104d4565b600b546001600160a01b0390811690831603610d855760405162461bcd60e51b815260206004820152601660248201527521b0b73737ba103132903932bbb0b932103a37b5b2b760511b60448201526064016104d4565b610d996001600160a01b0383163383611b7a565b7f74545154aac348a3eac92596bd1971957ca94795f4e954ec5f613b55fab781298282604051610dca92919061242d565b60405180910390a15050565b600254600160a81b900460ff1615610e265760405162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481a5b9a5d1a585b1a5e9959606a1b60448201526064016104d4565b6002546001600160a01b03163314610e6e5760405162461bcd60e51b815260206004820152600b60248201526a4e6f7420666163746f727960a81b60448201526064016104d4565b6002805460ff60a81b1916600160a81b179055600c80546001600160a01b03808d166001600160a01b031992831617909255600b8054928c1692909116919091179055600888905560058790556004869055600d849055600e839055600f8290558415610eee576002805460ff60a01b1916600160a01b17905560078590555b600b546040805163313ce56760e01b815290516000926001600160a01b03169163313ce5679160048083019260209291908290030181865afa158015610f38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5c9190612446565b60ff169050601e8110610faa5760405162461bcd60e51b815260206004820152601660248201527504d75737420626520696e666572696f7220746f2033360541b60448201526064016104d4565b610fb581601e6123eb565b610fc090600a61254d565b600955600554600655610fd282611955565b5050505050505050505050565b61105e60405180610180016040528060006001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b031681526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b506040805161018081018252308152600c546001600160a01b039081166020830152600b5416918101919091526008546060820152600554608082015260045460a082015260075460c0820152600d5460e0820152600e54610100820152600f5461012082015260105461014082015260115461016082015290565b6110e2611aa0565b6110ec6000611c38565b565b6110f6611aa0565b43600455565b6000546001600160a01b031690565b611113611aa0565b60055443106111345760405162461bcd60e51b81526004016104d49061223b565b80821061119a5760405162461bcd60e51b815260206004820152602e60248201527f4e6577207374617274426c6f636b206d757374206265206c6f7765722074686160448201526d6e206e657720656e64426c6f636b60901b60648201526084016104d4565b8143106112025760405162461bcd60e51b815260206004820152603060248201527f4e6577207374617274426c6f636b206d7573742062652068696768657220746860448201526f616e2063757272656e7420626c6f636b60801b60648201526084016104d4565b60058290556004819055600682905560408051838152602081018390527f7cd0ab87d19036f3dfadadb232c78aa4879dda3f0c994a9d637532410ee2ce069101610dca565b61124f611aa0565b600254600160a01b900460ff166112965760405162461bcd60e51b815260206004820152600b60248201526a135d5cdd081899481cd95d60aa1b60448201526064016104d4565b81156112f25760075481116112e85760405162461bcd60e51b81526020600482015260186024820152772732bb903634b6b4ba1036bab9ba103132903434b3b432b960411b60448201526064016104d4565b600781905561130f565b6002805460ff60a01b1916600160a01b8415150217905560006007555b7f241f67ee5f41b7a5cabf911367329be7215900f602ebfc47f89dce2a6bcd847c600754604051610dca91815260200190565b61134a611ad2565b600d5481111561136c5760405162461bcd60e51b81526004016104d490612559565b600e5481101561138e5760405162461bcd60e51b81526004016104d49061233a565b600082116113ae5760405162461bcd60e51b81526004016104d490612295565b60045443106113cf5760405162461bcd60e51b81526004016104d490612265565b336000908152601460205260409020600254600160a01b900460ff161561141d5760075481546113ff9085612327565b111561141d5760405162461bcd60e51b81526004016104d490612370565b611425611afc565b60008160020154600954600354846001015485600001546114469190612327565b61145091906123b2565b61145a91906123c9565b61146491906123eb565b9050801561148357600b54611483906001600160a01b03163383611b7a565b600061148f85856107c8565b600c549091506114aa906001600160a01b0316333088611bd7565b846010546114b89190612327565b6010556011546114c9908290612327565b601155601280546040805160a08101825282815233602082015290810188905260608101849052909190608081016115018842612327565b90528154600180820184556000938452602080852084516005909402019283558381015191830180546001600160a01b0319166001600160a01b039093169290921790915560408084015160028401556060840151600384015560809093015160049092019190915533835260139052902061157d9082611c88565b50835461158b908790612327565b8455600184015461159d908390612327565b600185018190556009546003548654919290916115ba9190612327565b6115c491906123b2565b6115ce91906123c9565b6002850155600c546040516001600160a01b039091169033907f7f30f7ade10235024f1854ad696cbe0694c0a4b2cbb8ac220da62b3d267326c2906107af9085908b908b908990612590565b611622611ad2565b60045443106116435760405162461bcd60e51b81526004016104d490612265565b600060128381548110611658576116586122c8565b600091825260209091206001600590920201908101549091506001600160a01b031633146116985760405162461bcd60e51b81526004016104d4906122de565b600d546116a59042612327565b8282600401546116b59190612327565b11156116d35760405162461bcd60e51b81526004016104d490612559565b600e546116e09042612327565b8282600401546116f09190612327565b101561170e5760405162461bcd60e51b81526004016104d49061233a565b336000908152601460205260409020611725611afc565b60008160020154600954600354846001015485600001546117469190612327565b61175091906123b2565b61175a91906123c9565b61176491906123eb565b9050801561178357600b54611783906001600160a01b03163383611b7a565b60006117a884600201544287876004015461179e9190612327565b61026691906123eb565b90508084600301546011546117bd91906123eb565b6117c79190612327565b6011556003840154600184015482916117df916123eb565b6117e99190612327565b6001840155600384018054908290556004850154611808908790612327565b6004860155600954600354600186015486546118249190612327565b61182e91906123b2565b61183891906123c9565b6002850155600c546040516001600160a01b039091169033907fa52e98af98f353eed9469e7910c049b65ad8f546c2a253afa9dda04506caa59290611884908b908b9087908990612590565b60405180910390a350505050506107c460018055565b6118a2611ad2565b3360009081526014602052604090206118b9611afc565b60008160020154600954600354846001015485600001546118da9190612327565b6118e491906123b2565b6118ee91906123c9565b6118f891906123eb565b9050801561191757600b54611917906001600160a01b03163383611b7a565b6009546003546001840154845461192e9190612327565b61193891906123b2565b61194291906123c9565b826002018190555050506110ec60018055565b61195d611aa0565b6001600160a01b038116611987576000604051631e4fbdf760e01b81526004016104d491906121fb565b610c6281611c38565b6001600160a01b0381166000908152601460205260408120601054600654431180156119bb57508015155b15611a5e5760006119ce60065443611c94565b90506000600854826119e091906123b2565b90506000601154846119f29190612327565b6009546119ff90846123b2565b611a0991906123c9565b600354611a169190612327565b905084600201546009548287600101548860000154611a359190612327565b611a3f91906123b2565b611a4991906123c9565b611a5391906123eb565b979650505050505050565b600282015460095460035460018501548554611a7a9190612327565b611a8491906123b2565b611a8e91906123c9565b611a9891906123eb565b949350505050565b33611aa96110fc565b6001600160a01b0316146110ec573360405163118cdaa760e01b81526004016104d491906121fb565b600260015403611af557604051633ee5aeb560e01b815260040160405180910390fd5b6002600155565b6006544311611b0757565b6010546000819003611b1a575043600655565b6000611b2860065443611c94565b9050600060085482611b3a91906123b2565b905060115483611b4a9190612327565b600954611b5790836123b2565b611b6191906123c9565b600354611b6e9190612327565b60035550504360065550565b611bd283846001600160a01b031663a9059cbb8585604051602401611ba092919061242d565b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050611ccf565b505050565b6040516001600160a01b038481166024830152838116604483015260648201839052611c109186918216906323b872dd90608401611ba0565b50505050565b6000610840825490565b600061083d8383611d29565b600061083d8383611d53565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600061083d8383611e46565b60006004548211611cb057611ca983836123eb565b9050610840565b6004548310611cc157506000610840565b82600454611ca991906123eb565b6000611ce46001600160a01b03841683611e95565b90508051600014158015611d09575080806020019051810190611d0791906125ab565b155b15611bd25782604051635274afe760e01b81526004016104d491906121fb565b6000826000018281548110611d4057611d406122c8565b9060005260206000200154905092915050565b60008181526001830160205260408120548015611e3c576000611d776001836123eb565b8554909150600090611d8b906001906123eb565b9050808214611df0576000866000018281548110611dab57611dab6122c8565b9060005260206000200154905080876000018481548110611dce57611dce6122c8565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080611e0157611e016125c8565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610840565b6000915050610840565b6000818152600183016020526040812054611e8d57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610840565b506000610840565b606061083d8383600084600080856001600160a01b03168486604051611ebb91906125de565b60006040518083038185875af1925050503d8060008114611ef8576040519150601f19603f3d011682016040523d82523d6000602084013e611efd565b606091505b5091509150611f0d868383611f19565b925050505b9392505050565b606082611f2e57611f2982611f6c565b611f12565b8151158015611f4557506001600160a01b0384163b155b15611f655783604051639996b31560e01b81526004016104d491906121fb565b5080611f12565b805115611f7c5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b600060208284031215611fa757600080fd5b5035919050565b60008060408385031215611fc157600080fd5b50508035926020909101359150565b6001600160a01b0381168114610c6257600080fd5b600060208284031215611ff757600080fd5b8135611f1281611fd0565b9283526020830191909152604082015260600190565b6001600160a01b03169052565b602080825282518282018190526000919060409081850190868401855b8281101561208f57815180518552868101516001600160a01b0316878601528581015186860152606080820151908601526080908101519085015260a09093019290850190600101612042565b5091979650505050505050565b600080604083850312156120af57600080fd5b82356120ba81611fd0565b946020939093013593505050565b6000806000806000806000806000806101408b8d0312156120e857600080fd5b8a356120f381611fd0565b995060208b013561210381611fd0565b985060408b0135975060608b0135965060808b0135955060a08b0135945060c08b0135935060e08b013592506101008b013591506101208b013561214681611fd0565b809150509295989b9194979a5092959850565b60006101808201905061216d828451612018565b602083015161217f6020840182612018565b5060408301516121926040840182612018565b50606083015160608301526080830151608083015260a083015160a083015260c083015160c083015260e083015160e083015261010080840151818401525061012080840151818401525061014080840151818401525061016080840151818401525092915050565b6001600160a01b0391909116815260200190565b8015158114610c6257600080fd5b6000806040838503121561223057600080fd5b82356120ba8161220f565b60208082526010908201526f141bdbdb081a185cc81cdd185c9d195960821b604082015260600190565b602080825260169082015275105b1c1a18541bdbdb0e881c1bdbdb0818db1bdcd95960521b604082015260600190565b602080825260199082015278416c706861506f6f6c3a20616d6f756e7420746f6f206c6f7760381b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b602080825260199082015278105b1c1a18541bdbdb0e881b9bdd08185d5d1a1bdc9a5e9959603a1b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b8082018082111561084057610840612311565b6020808252601c908201527b416c706861506f6f6c3a206c6f636b2074696d6520746f6f206c6f7760201b604082015260600190565b60208082526022908201527f416c706861506f6f6c3a205573657220616d6f756e742061626f7665206c696d6040820152611a5d60f21b606082015260800190565b808202811582820484141761084057610840612311565b6000826123e657634e487b7160e01b600052601260045260246000fd5b500490565b8181038181111561084057610840612311565b634e487b7160e01b600052604160045260246000fd5b60006001820161242657612426612311565b5060010190565b6001600160a01b03929092168252602082015260400190565b60006020828403121561245857600080fd5b815160ff81168114611f1257600080fd5b600181815b808511156124a457816000190482111561248a5761248a612311565b8085161561249757918102915b93841c939080029061246e565b509250929050565b6000826124bb57506001610840565b816124c857506000610840565b81600181146124de57600281146124e857612504565b6001915050610840565b60ff8411156124f9576124f9612311565b50506001821b610840565b5060208310610133831016604e8410600b8410161715612527575081810a610840565b6125318383612469565b806000190482111561254557612545612311565b029392505050565b600061083d83836124ac565b6020808252601d908201527f416c706861506f6f6c3a206c6f636b2074696d6520746f6f2068696768000000604082015260600190565b93845260208401929092526040830152606082015260800190565b6000602082840312156125bd57600080fd5b8151611f128161220f565b634e487b7160e01b600052603160045260246000fd5b6000825160005b818110156125ff57602081860181015185830152016125e5565b50600092019182525091905056fea26469706673582212201cb3a893b062483fe324b6bbe6a573f1eeae7e3013586ef9a9e238646bea74ae64736f6c63430008140033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

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