ETH Price: $2,343.46 (+4.80%)
Gas: 0.07 Gwei

Contract

0xc3b299a2Eb2cba246f87EA50ff8a5D30BEc2762D
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Emergency Reward...244533372026-02-14 6:48:5930 days ago1771051739IN
0xc3b299a2...0BEc2762D
0 ETH0.00010722.03614927
Withdraw210361712024-10-24 14:51:11508 days ago1729781471IN
0xc3b299a2...0BEc2762D
0.00289 ETH0.0034380113.22561376
Withdraw209626162024-10-14 8:27:59518 days ago1728894479IN
0xc3b299a2...0BEc2762D
0.00289 ETH0.0022481912.20791991
Claim Reward208125692024-09-23 10:04:11539 days ago1727085851IN
0xc3b299a2...0BEc2762D
0.00289 ETH0.0021408917.51210724
Withdraw207081722024-09-08 20:07:35554 days ago1725826055IN
0xc3b299a2...0BEc2762D
0.00289 ETH0.000199031.33095751
Withdraw206668172024-09-03 1:38:35560 days ago1725327515IN
0xc3b299a2...0BEc2762D
0.00289 ETH0.000218921.59510864
Withdraw206668132024-09-03 1:37:47560 days ago1725327467IN
0xc3b299a2...0BEc2762D
0.00289 ETH0.0002481.66616993
Withdraw206668062024-09-03 1:36:23560 days ago1725327383IN
0xc3b299a2...0BEc2762D
0.00289 ETH0.000241821.5946828
Withdraw206667942024-09-03 1:33:59560 days ago1725327239IN
0xc3b299a2...0BEc2762D
0.00289 ETH0.000280841.71305877
Claim Reward206667842024-09-03 1:31:59560 days ago1725327119IN
0xc3b299a2...0BEc2762D
0.00289 ETH0.000217391.77821597
Withdraw206647452024-09-02 18:42:35560 days ago1725302555IN
0xc3b299a2...0BEc2762D
0.00289 ETH0.001159847.75574885
Claim Reward206647412024-09-02 18:41:47560 days ago1725302507IN
0xc3b299a2...0BEc2762D
0.00289 ETH0.000890398.46771021
Withdraw206273942024-08-28 13:29:47565 days ago1724851787IN
0xc3b299a2...0BEc2762D
0.00289 ETH0.000296141.98029813
Withdraw206261042024-08-28 9:10:59565 days ago1724836259IN
0xc3b299a2...0BEc2762D
0.00289 ETH0.000493792.41104544
Withdraw206200402024-08-27 12:52:11566 days ago1724763131IN
0xc3b299a2...0BEc2762D
0.00289 ETH0.000332691.62488797
Claim Reward205773512024-08-21 13:39:23572 days ago1724247563IN
0xc3b299a2...0BEc2762D
0.00289 ETH0.000384263.14326087
Claim Reward205190192024-08-13 10:10:59580 days ago1723543859IN
0xc3b299a2...0BEc2762D
0.00289 ETH0.000293482.40062556
Claim Reward205136692024-08-12 16:16:59581 days ago1723479419IN
0xc3b299a2...0BEc2762D
0.00289 ETH0.00120549.86003091
Withdraw205109242024-08-12 7:04:35581 days ago1723446275IN
0xc3b299a2...0BEc2762D
0.00289 ETH0.000473511.94935167
Withdraw205070532024-08-11 18:07:11582 days ago1723399631IN
0xc3b299a2...0BEc2762D
0.00289 ETH0.000253511.69520019
Claim Reward204956812024-08-10 4:00:11583 days ago1723262411IN
0xc3b299a2...0BEc2762D
0.00289 ETH0.00013161.07653356
Withdraw204925862024-08-09 17:38:35584 days ago1723225115IN
0xc3b299a2...0BEc2762D
0.00289 ETH0.000630783.07990493
Claim Reward204923692024-08-09 16:54:59584 days ago1723222499IN
0xc3b299a2...0BEc2762D
0.00289 ETH0.000477784.54371858
Claim Reward204916242024-08-09 14:24:59584 days ago1723213499IN
0xc3b299a2...0BEc2762D
0.00289 ETH0.001037698.48820167
Withdraw204914782024-08-09 13:55:35584 days ago1723211735IN
0xc3b299a2...0BEc2762D
0.00289 ETH0.00140089.36702776
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Method Block
From
To
Transfer210361712024-10-24 14:51:11508 days ago1729781471
0xc3b299a2...0BEc2762D
0.00289 ETH
Transfer209626162024-10-14 8:27:59518 days ago1728894479
0xc3b299a2...0BEc2762D
0.00289 ETH
Transfer208125692024-09-23 10:04:11539 days ago1727085851
0xc3b299a2...0BEc2762D
0.00289 ETH
Transfer207081722024-09-08 20:07:35554 days ago1725826055
0xc3b299a2...0BEc2762D
0.00289 ETH
Transfer206668172024-09-03 1:38:35560 days ago1725327515
0xc3b299a2...0BEc2762D
0.00289 ETH
Transfer206668132024-09-03 1:37:47560 days ago1725327467
0xc3b299a2...0BEc2762D
0.00289 ETH
Transfer206668062024-09-03 1:36:23560 days ago1725327383
0xc3b299a2...0BEc2762D
0.00289 ETH
Transfer206667942024-09-03 1:33:59560 days ago1725327239
0xc3b299a2...0BEc2762D
0.00289 ETH
Transfer206667842024-09-03 1:31:59560 days ago1725327119
0xc3b299a2...0BEc2762D
0.00289 ETH
Transfer206647452024-09-02 18:42:35560 days ago1725302555
0xc3b299a2...0BEc2762D
0.00289 ETH
Transfer206647412024-09-02 18:41:47560 days ago1725302507
0xc3b299a2...0BEc2762D
0.00289 ETH
Transfer206273942024-08-28 13:29:47565 days ago1724851787
0xc3b299a2...0BEc2762D
0.00289 ETH
Transfer206261042024-08-28 9:10:59565 days ago1724836259
0xc3b299a2...0BEc2762D
0.00289 ETH
Transfer206200402024-08-27 12:52:11566 days ago1724763131
0xc3b299a2...0BEc2762D
0.00289 ETH
Transfer205773512024-08-21 13:39:23572 days ago1724247563
0xc3b299a2...0BEc2762D
0.00289 ETH
Transfer205190192024-08-13 10:10:59580 days ago1723543859
0xc3b299a2...0BEc2762D
0.00289 ETH
Transfer205136692024-08-12 16:16:59581 days ago1723479419
0xc3b299a2...0BEc2762D
0.00289 ETH
Transfer205109242024-08-12 7:04:35581 days ago1723446275
0xc3b299a2...0BEc2762D
0.00289 ETH
Transfer205070532024-08-11 18:07:11582 days ago1723399631
0xc3b299a2...0BEc2762D
0.00289 ETH
Transfer204956812024-08-10 4:00:11583 days ago1723262411
0xc3b299a2...0BEc2762D
0.00289 ETH
Transfer204925862024-08-09 17:38:35584 days ago1723225115
0xc3b299a2...0BEc2762D
0.00289 ETH
Transfer204923692024-08-09 16:54:59584 days ago1723222499
0xc3b299a2...0BEc2762D
0.00289 ETH
Transfer204916242024-08-09 14:24:59584 days ago1723213499
0xc3b299a2...0BEc2762D
0.00289 ETH
Transfer204914782024-08-09 13:55:35584 days ago1723211735
0xc3b299a2...0BEc2762D
0.00289 ETH
Transfer204901832024-08-09 9:35:35584 days ago1723196135
0xc3b299a2...0BEc2762D
0.00289 ETH
View All Internal Transactions
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

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

Contract Source Code Verified (Exact Match)

Contract Name:
SpriteOnsenNftStaking

Compiler Version
v0.8.14+commit.80d49f37

Optimization Enabled:
Yes with 100 runs

Other Settings:
default evmVersion
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/**
 * @author Brewlabs
 * This contract has been developed by brewlabs.info
 */
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import {IERC20, IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import {IERC721Receiver} from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";

contract SpriteOnsenNftStaking is Ownable, IERC721Receiver, ReentrancyGuard {
    using SafeERC20 for IERC20;

    bytes4 private constant _ERC721_RECEIVED = 0x150b7a02;
    uint256 private constant BLOCKS_PER_DAY = 6426;
    uint256 private PRECISION_FACTOR;

    // Whether it is initialized
    bool public isInitialized;
    uint256 public duration = 365; // 365 days

    // The block number when staking starts.
    uint256 public startBlock;
    // The block number when staking ends.
    uint256 public bonusEndBlock;
    // tokens created per block.
    uint256 public rewardPerBlock;
    // The block number of the last pool update
    uint256 public lastRewardBlock;

    address public treasury = 0x64961Ffd0d84b2355eC2B5d35B0d8D8825A774dc;
    uint256 public performanceFee = 0.00089 ether;

    // The staked token
    IERC721 public stakingNft;
    // The earned token
    IERC20 public earnedToken;
    // Accrued token per share
    uint256 public accTokenPerShare;
    uint256 public oneTimeLimit = 40;
    bool public autoAdjustableForRewardRate = true;

    uint256 public totalStaked;
    uint256 private paidRewards;
    uint256 private shouldTotalPaid;

    struct UserInfo {
        uint256 amount; // number of staked NFTs
        uint256[] tokenIds; // staked tokenIds
        uint256 rewardDebt; // Reward debt
    }
    // Info of each user that stakes tokenIds

    mapping(address => UserInfo) public userInfo;

    event Deposit(address indexed user, uint256[] tokenIds);
    event Withdraw(address indexed user, uint256[] tokenIds);
    event Claim(address indexed user, uint256 amount);
    event EmergencyWithdraw(address indexed user, uint256[] tokenIds);
    event AdminTokenRecovered(address tokenRecovered, uint256 amount);

    event NewStartAndEndBlocks(uint256 startBlock, uint256 endBlock);
    event NewRewardPerBlock(uint256 rewardPerBlock);
    event RewardsStop(uint256 blockNumber);
    event EndBlockUpdated(uint256 blockNumber);

    event ServiceInfoUpadted(address _addr, uint256 _fee);
    event DurationUpdated(uint256 _duration);
    event SetAutoAdjustableForRewardRate(bool status);

    constructor() {}

    /**
     * @notice Initialize the contract
     * @param _stakingNft: nft address to stake
     * @param _earnedToken: earned token address
     * @param _rewardPerBlock: reward per block (in earnedToken)
     */
    function initialize(IERC721 _stakingNft, IERC20 _earnedToken, uint256 _rewardPerBlock) external onlyOwner {
        require(!isInitialized, "Already initialized");

        // Make this contract initialized
        isInitialized = true;

        stakingNft = _stakingNft;
        earnedToken = _earnedToken;
        rewardPerBlock = _rewardPerBlock;

        uint256 decimalsRewardToken = uint256(IERC20Metadata(address(earnedToken)).decimals());
        require(decimalsRewardToken < 30, "Must be inferior to 30");
        PRECISION_FACTOR = uint256(10 ** (40 - decimalsRewardToken));
    }

    /**
     * @notice Deposit NFTs and collect reward tokens (if any)
     * @param _tokenIds: tokenIds to stake
     */
    function deposit(uint256[] memory _tokenIds) external payable nonReentrant {
        require(startBlock > 0 && startBlock < block.number, "Staking hasn't started yet");
        require(_tokenIds.length > 0, "must add at least one tokenId");
        require(_tokenIds.length <= oneTimeLimit, "cannot exceed one-time limit");

        _transferPerformanceFee();
        _updatePool();

        UserInfo storage user = userInfo[msg.sender];
        if (user.amount > 0) {
            uint256 pending = (user.amount * accTokenPerShare) / PRECISION_FACTOR - user.rewardDebt;
            if (pending > 0) {
                require(availableRewardTokens() >= pending, "Insufficient reward tokens");
                earnedToken.safeTransfer(address(msg.sender), pending);
                paidRewards += pending;
                emit Claim(msg.sender, pending);
            }
        }

        for (uint256 i = 0; i < _tokenIds.length; i++) {
            uint256 tokenId = _tokenIds[i];
            stakingNft.safeTransferFrom(msg.sender, address(this), tokenId);
            user.tokenIds.push(tokenId);
        }
        user.amount = user.amount + _tokenIds.length;
        user.rewardDebt = (user.amount * accTokenPerShare) / PRECISION_FACTOR;

        totalStaked = totalStaked + _tokenIds.length;
        emit Deposit(msg.sender, _tokenIds);

        if (autoAdjustableForRewardRate) _updateRewardRate();
    }

    /**
     * @notice Withdraw staked tokenIds and collect reward tokens
     * @param _amount: number of tokenIds to unstake
     */
    function withdraw(uint256 _amount) external payable nonReentrant {
        require(_amount > 0, "Amount should be greator than 0");
        require(_amount <= oneTimeLimit, "cannot exceed one-time limit");

        UserInfo storage user = userInfo[msg.sender];
        require(user.amount >= _amount, "Amount to withdraw too high");

        _transferPerformanceFee();
        _updatePool();

        if (user.amount > 0) {
            uint256 pending = (user.amount * accTokenPerShare) / PRECISION_FACTOR - user.rewardDebt;
            if (pending > 0) {
                require(availableRewardTokens() >= pending, "Insufficient reward tokens");
                earnedToken.safeTransfer(address(msg.sender), pending);
                paidRewards += pending;
                emit Claim(msg.sender, pending);
            }
        }

        uint256[] memory _tokenIds = new uint256[](_amount);
        for (uint256 i = 0; i < _amount; i++) {
            uint256 tokenId = user.tokenIds[user.tokenIds.length - 1];
            user.tokenIds.pop();

            _tokenIds[i] = tokenId;
            stakingNft.safeTransferFrom(address(this), msg.sender, tokenId);
        }
        user.amount = user.amount - _amount;
        user.rewardDebt = (user.amount * accTokenPerShare) / PRECISION_FACTOR;

        totalStaked = totalStaked - _amount;
        emit Withdraw(msg.sender, _tokenIds);

        if (autoAdjustableForRewardRate) _updateRewardRate();
    }

    function claimReward() external payable nonReentrant {
        UserInfo storage user = userInfo[msg.sender];

        _transferPerformanceFee();
        _updatePool();

        if (user.amount == 0) return;

        uint256 pending = (user.amount * accTokenPerShare) / PRECISION_FACTOR - user.rewardDebt;
        if (pending > 0) {
            require(availableRewardTokens() >= pending, "Insufficient reward tokens");
            earnedToken.safeTransfer(address(msg.sender), pending);
            paidRewards += pending;
        }

        user.rewardDebt = (user.amount * accTokenPerShare) / PRECISION_FACTOR;
        emit Claim(msg.sender, pending);

        if (autoAdjustableForRewardRate) _updateRewardRate();
    }

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

        uint256[] memory _tokenIds = new uint256[](_amount);
        for (uint256 i = 0; i < _amount; i++) {
            uint256 tokenId = user.tokenIds[user.tokenIds.length - 1];
            user.tokenIds.pop();

            _tokenIds[i] = tokenId;
            stakingNft.safeTransferFrom(address(this), msg.sender, tokenId);
        }
        user.amount = user.amount - _amount;
        user.rewardDebt = (user.amount * accTokenPerShare) / PRECISION_FACTOR;
        totalStaked = totalStaked - _amount;

        emit EmergencyWithdraw(msg.sender, _tokenIds);
    }

    function stakedInfo(address _user) external view returns (uint256, uint256[] memory) {
        return (userInfo[_user].amount, userInfo[_user].tokenIds);
    }

    /**
     * @notice Available amount of reward token
     */
    function availableRewardTokens() public view returns (uint256) {
        return earnedToken.balanceOf(address(this));
    }

    function insufficientRewards() external view returns (uint256) {
        uint256 adjustedShouldTotalPaid = shouldTotalPaid;
        uint256 remainRewards = availableRewardTokens() + paidRewards;

        if (startBlock == 0) {
            adjustedShouldTotalPaid += rewardPerBlock * duration * BLOCKS_PER_DAY;
        } else {
            uint256 remainBlocks = _getMultiplier(lastRewardBlock, bonusEndBlock);
            adjustedShouldTotalPaid += rewardPerBlock * remainBlocks;
        }

        if (remainRewards >= adjustedShouldTotalPaid) return 0;
        return adjustedShouldTotalPaid - remainRewards;
    }

    /**
     * @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 adjustedTokenPerShare = accTokenPerShare;
        if (block.number > lastRewardBlock && totalStaked > 0 && lastRewardBlock > 0) {
            uint256 multiplier = _getMultiplier(lastRewardBlock, block.number);
            uint256 rewards = multiplier * rewardPerBlock;

            adjustedTokenPerShare += (rewards * PRECISION_FACTOR) / totalStaked;
        }

        return (user.amount * adjustedTokenPerShare) / PRECISION_FACTOR - user.rewardDebt;
    }

    /**
     * Admin Methods
     */
    function increaseEmissionRate(uint256 _amount) external onlyOwner {
        require(startBlock > 0, "pool is not started");
        require(bonusEndBlock > block.number, "pool was already finished");
        require(_amount > 0, "invalid amount");

        _updatePool();
        earnedToken.safeTransferFrom(msg.sender, address(this), _amount);

        uint256 remainRewards = availableRewardTokens() + paidRewards;
        if (remainRewards > shouldTotalPaid) {
            remainRewards = remainRewards - shouldTotalPaid;

            uint256 remainBlocks = bonusEndBlock - block.number;
            rewardPerBlock = remainRewards / remainBlocks;
            emit NewRewardPerBlock(rewardPerBlock);
        }
    }

    function _updateRewardRate() internal {
        if (bonusEndBlock <= block.number) return;

        uint256 remainRewards = availableRewardTokens() + paidRewards;
        if (remainRewards > shouldTotalPaid) {
            remainRewards = remainRewards - shouldTotalPaid;

            uint256 remainBlocks = bonusEndBlock - block.number;
            rewardPerBlock = remainRewards / remainBlocks;
            emit NewRewardPerBlock(rewardPerBlock);
        }
    }

    /**
     * @notice Withdraw reward token
     * @dev Only callable by owner. Needs to be for emergency.
     */
    function emergencyRewardWithdraw(uint256 _amount) external onlyOwner {
        require(block.number > bonusEndBlock, "Pool is running");
        require(availableRewardTokens() >= _amount, "Insufficient reward tokens");

        if (_amount == 0) _amount = availableRewardTokens();
        earnedToken.safeTransfer(address(msg.sender), _amount);
    }

    function startReward() external onlyOwner {
        require(startBlock == 0, "Pool was already started");

        startBlock = block.number + 100;
        bonusEndBlock = startBlock + duration * BLOCKS_PER_DAY;
        lastRewardBlock = startBlock;

        emit NewStartAndEndBlocks(startBlock, bonusEndBlock);
    }

    function stopReward() external onlyOwner {
        _updatePool();

        uint256 remainRewards = availableRewardTokens() + paidRewards;
        if (remainRewards > shouldTotalPaid) {
            remainRewards = remainRewards - shouldTotalPaid;
            earnedToken.transfer(msg.sender, remainRewards);
        }

        bonusEndBlock = block.number;
        emit RewardsStop(bonusEndBlock);
    }

    function updateEndBlock(uint256 _endBlock) external onlyOwner {
        require(startBlock > 0, "Pool is not started");
        require(bonusEndBlock > block.number, "Pool was already finished");
        require(_endBlock > block.number && _endBlock > startBlock, "Invalid end block");

        bonusEndBlock = _endBlock;
        emit EndBlockUpdated(_endBlock);
    }

    /**
     * @notice Update reward per block
     * @dev Only callable by owner.
     * @param _rewardPerBlock: the reward per block
     */
    function updateRewardPerBlock(uint256 _rewardPerBlock) external onlyOwner {
        _updatePool();

        rewardPerBlock = _rewardPerBlock;
        emit NewRewardPerBlock(_rewardPerBlock);
    }

    function setDuration(uint256 _duration) external onlyOwner {
        require(_duration >= 30, "lower limit reached");

        duration = _duration;
        if (startBlock > 0) {
            bonusEndBlock = startBlock + duration * BLOCKS_PER_DAY;
            require(bonusEndBlock > block.number, "invalid duration");
        }
        emit DurationUpdated(_duration);
    }

    function setAutoAdjustableForRewardRate(bool _status) external onlyOwner {
        autoAdjustableForRewardRate = _status;
        emit SetAutoAdjustableForRewardRate(_status);
    }

    function setServiceInfo(address _treasury, uint256 _fee) external {
        require(msg.sender == treasury, "setServiceInfo: FORBIDDEN");
        require(_treasury != address(0x0), "Invalid address");

        treasury = _treasury;
        performanceFee = _fee;
        emit ServiceInfoUpadted(_treasury, _fee);
    }

    /**
     * @notice It allows the admin to recover wrong tokens sent to the contract
     * @param _token: the address of the token to withdraw
     * @dev This function is only callable by admin.
     */
    function rescueTokens(address _token) external onlyOwner {
        require(_token != address(earnedToken), "Cannot be reward token");

        uint256 amount = address(this).balance;
        if (_token == address(0x0)) {
            payable(msg.sender).transfer(amount);
        } else {
            amount = IERC20(_token).balanceOf(address(this));
            IERC20(_token).safeTransfer(address(msg.sender), amount);
        }

        emit AdminTokenRecovered(_token, amount);
    }

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

        uint256 multiplier = _getMultiplier(lastRewardBlock, block.number);
        uint256 _reward = multiplier * rewardPerBlock;
        accTokenPerShare += (_reward * PRECISION_FACTOR) / totalStaked;
        lastRewardBlock = block.number;

        shouldTotalPaid += _reward;
    }

    /**
     * @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 _transferPerformanceFee() internal {
        require(msg.value >= performanceFee, "should pay small gas to compound or harvest");

        payable(treasury).transfer(performanceFee);
        if (msg.value > performanceFee) {
            payable(msg.sender).transfer(msg.value - performanceFee);
        }
    }

    /**
     * onERC721Received(address operator, address from, uint256 tokenId, bytes data) → bytes4
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     */
    function onERC721Received(address, address, uint256, bytes calldata) external view override returns (bytes4) {
        require(msg.sender == address(stakingNft), "not enabled NFT");
        return _ERC721_RECEIVED;
    }

    receive() external payable {}
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

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

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

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

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
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].
     */
    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 v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

File 9 of 12 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

pragma solidity ^0.8.0;

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

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

Contract Security Audit

Contract ABI

API
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"tokenRecovered","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"AdminTokenRecovered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Claim","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_duration","type":"uint256"}],"name":"DurationUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"EmergencyWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"blockNumber","type":"uint256"}],"name":"EndBlockUpdated","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":false,"internalType":"address","name":"_addr","type":"address"},{"indexed":false,"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"ServiceInfoUpadted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"status","type":"bool"}],"name":"SetAutoAdjustableForRewardRate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"accTokenPerShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"autoAdjustableForRewardRate","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"availableRewardTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bonusEndBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimReward","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"duration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"earnedToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"emergencyRewardWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"increaseEmissionRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_stakingNft","type":"address"},{"internalType":"contract IERC20","name":"_earnedToken","type":"address"},{"internalType":"uint256","name":"_rewardPerBlock","type":"uint256"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"insufficientRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oneTimeLimit","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":"performanceFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"rescueTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardPerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_status","type":"bool"}],"name":"setAutoAdjustableForRewardRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_duration","type":"uint256"}],"name":"setDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_treasury","type":"address"},{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setServiceInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"stakedInfo","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakingNft","outputs":[{"internalType":"contract IERC721","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"startBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"startReward","outputs":[],"stateMutability":"nonpayable","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":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_endBlock","type":"uint256"}],"name":"updateEndBlock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rewardPerBlock","type":"uint256"}],"name":"updateRewardPerBlock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userInfo","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"rewardDebt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"payable","type":"function"},{"stateMutability":"payable","type":"receive"}]

608060405261016d600455600980546001600160a01b0319167364961ffd0d84b2355ec2b5d35b0d8d8825a774dc1790556603297345d9a000600a556028600e55600f805460ff1916600117905534801561005957600080fd5b506100633361006c565b600180556100bc565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6129c3806100cb6000396000f3fe6080604052600436106102075760003560e01c806380dc067211610113578063a9f8d181116100ab578063f2fde38b1161006f578063f2fde38b146105e4578063f3aeb31d14610604578063f40f0f5214610619578063f4ef5ed514610639578063f6be71d11461065957600080fd5b8063a9f8d18114610563578063b493877714610579578063b88a802f146105a7578063cd635cce146105af578063db2e21bc146105cf57600080fd5b806380dc06721461048d578063817b1cd2146104a257806381b61948146104b857806387788782146104d85780638ae39cac146104ee5780638da5cb5b146105045780638f662915146105225780639f94e27214610538578063a2cd12d21461054d57600080fd5b80632e1a7d4d116101a157806361d027b31161016557806361d027b3146103f65780636982d815146104235780636e707b7314610443578063715018a614610463578063746c8ae11461047857600080fd5b80632e1a7d4d146103805780633279beab14610393578063392e53cd146103b357806348cd4cb1146103cd578063598b8e71146103e357600080fd5b80626f023114610213578062ae3bf81461023557806301f8a976146102555780630fb5a6b414610275578063150b7a021461029e5780631794bb3c146102d75780631959a002146102f75780631aed655314610340578063249375671461035657600080fd5b3661020e57005b600080fd5b34801561021f57600080fd5b5061023361022e36600461233b565b610679565b005b34801561024157600080fd5b50610233610250366004612369565b6107a7565b34801561026157600080fd5b5061023361027036600461233b565b610908565b34801561028157600080fd5b5061028b60045481565b6040519081526020015b60405180910390f35b3480156102aa57600080fd5b506102be6102b936600461238d565b61093b565b6040516001600160e01b03199091168152602001610295565b3480156102e357600080fd5b506102336102f236600461242c565b61099c565b34801561030357600080fd5b5061032b610312366004612369565b6013602052600090815260409020805460029091015482565b60408051928352602083019190915201610295565b34801561034c57600080fd5b5061028b60065481565b34801561036257600080fd5b50600f546103709060ff1681565b6040519015158152602001610295565b61023361038e36600461233b565b610afc565b34801561039f57600080fd5b506102336103ae36600461233b565b610e81565b3480156103bf57600080fd5b506003546103709060ff1681565b3480156103d957600080fd5b5061028b60055481565b6102336103f1366004612483565b610f1d565b34801561040257600080fd5b50600954610416906001600160a01b031681565b6040516102959190612541565b34801561042f57600080fd5b50600b54610416906001600160a01b031681565b34801561044f57600080fd5b50600c54610416906001600160a01b031681565b34801561046f57600080fd5b50610233611228565b34801561048457600080fd5b5061023361123c565b34801561049957600080fd5b50610233611307565b3480156104ae57600080fd5b5061028b60105481565b3480156104c457600080fd5b506102336104d3366004612555565b6113f5565b3480156104e457600080fd5b5061028b600a5481565b3480156104fa57600080fd5b5061028b60075481565b34801561051057600080fd5b506000546001600160a01b0316610416565b34801561052e57600080fd5b5061028b600d5481565b34801561054457600080fd5b5061028b6114e5565b34801561055957600080fd5b5061028b600e5481565b34801561056f57600080fd5b5061028b60085481565b34801561058557600080fd5b50610599610594366004612369565b61155c565b6040516102959291906125bc565b6102336115d8565b3480156105bb57600080fd5b506102336105ca3660046125e3565b6116ff565b3480156105db57600080fd5b50610233611748565b3480156105f057600080fd5b506102336105ff366004612369565b61193c565b34801561061057600080fd5b5061028b6119b2565b34801561062557600080fd5b5061028b610634366004612369565b611a5a565b34801561064557600080fd5b5061023361065436600461233b565b611b18565b34801561066557600080fd5b5061023361067436600461233b565b611c90565b610681611d7f565b6000600554116106ce5760405162461bcd60e51b8152602060048201526013602482015272141bdbdb081a5cc81b9bdd081cdd185c9d1959606a1b60448201526064015b60405180910390fd5b436006541161071b5760405162461bcd60e51b8152602060048201526019602482015278141bdbdb081dd85cc8185b1c9958591e48199a5b9a5cda1959603a1b60448201526064016106c5565b438111801561072b575060055481115b61076b5760405162461bcd60e51b8152602060048201526011602482015270496e76616c696420656e6420626c6f636b60781b60448201526064016106c5565b60068190556040518181527f0972575658363b3e7c472ab3a6a918726742c853b732f6a4a2763e2e3a94c977906020015b60405180910390a150565b6107af611d7f565b600c546001600160a01b03908116908216036108065760405162461bcd60e51b815260206004820152601660248201527521b0b73737ba103132903932bbb0b932103a37b5b2b760511b60448201526064016106c5565b476001600160a01b03821661084857604051339082156108fc029083906000818181858888f19350505050158015610842573d6000803e3d6000fd5b506108cb565b6040516370a0823160e01b81526001600160a01b038316906370a0823190610874903090600401612541565b602060405180830381865afa158015610891573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108b59190612600565b90506108cb6001600160a01b0383163383611dd9565b7f74f5dcd55c394cb1c6d3b9da22c2464bcc46c38cc3865bd629ed75823249b40b82826040516108fc929190612619565b60405180910390a15050565b610910611d7f565b610918611e34565b600781905560405181815260008051602061294e8339815191529060200161079c565b600b546000906001600160a01b0316331461098a5760405162461bcd60e51b815260206004820152600f60248201526e1b9bdd08195b98589b195908139195608a1b60448201526064016106c5565b50630a85bd0160e11b95945050505050565b6109a4611d7f565b60035460ff16156109ed5760405162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481a5b9a5d1a585b1a5e9959606a1b60448201526064016106c5565b6003805460ff19166001179055600b80546001600160a01b038086166001600160a01b031992831617909255600c8054928516929091168217905560078290556040805163313ce56760e01b815290516000929163313ce5679160048281019260209291908290030181865afa158015610a6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8f9190612632565b60ff169050601e8110610add5760405162461bcd60e51b815260206004820152601660248201527504d75737420626520696e666572696f7220746f2033360541b60448201526064016106c5565b610ae881602861266b565b610af390600a612766565b60025550505050565b610b04611ed1565b60008111610b545760405162461bcd60e51b815260206004820152601f60248201527f416d6f756e742073686f756c642062652067726561746f72207468616e20300060448201526064016106c5565b600e54811115610b765760405162461bcd60e51b81526004016106c590612772565b3360009081526013602052604090208054821115610bd65760405162461bcd60e51b815260206004820152601b60248201527f416d6f756e7420746f20776974686472617720746f6f2068696768000000000060448201526064016106c5565b610bde611f2a565b610be6611e34565b805415610ca05760008160020154600254600d548460000154610c0991906127a9565b610c1391906127c8565b610c1d919061266b565b90508015610c9e5780610c2e6114e5565b1015610c4c5760405162461bcd60e51b81526004016106c5906127ea565b600c54610c63906001600160a01b03163383611dd9565b8060116000828254610c759190612821565b9091555050604051818152339060008051602061296e8339815191529060200160405180910390a25b505b60008267ffffffffffffffff811115610cbb57610cbb61246d565b604051908082528060200260200182016040528015610ce4578160200160208202803683370190505b50905060005b83811015610de35760018084018054600092610d059161266b565b81548110610d1557610d15612839565b9060005260206000200154905083600101805480610d3557610d3561284f565b6001900381819060005260206000200160009055905580838381518110610d5e57610d5e612839565b6020908102919091010152600b54604051632142170760e11b81526001600160a01b03909116906342842e0e90610d9d90309033908690600401612865565b600060405180830381600087803b158015610db757600080fd5b505af1158015610dcb573d6000803e3d6000fd5b50505050508080610ddb90612889565b915050610cea565b508154610df190849061266b565b808355600254600d549091610e0691906127a9565b610e1091906127c8565b6002830155601054610e2390849061266b565b60105560405133907f67e9df8b3c7743c9f1b625ba4f2b4e601206dbd46ed5c33c85a1242e4d23a2d190610e589084906128a2565b60405180910390a2600f5460ff1615610e7357610e73612012565b5050610e7e60018055565b50565b610e89611d7f565b6006544311610ecc5760405162461bcd60e51b815260206004820152600f60248201526e506f6f6c2069732072756e6e696e6760881b60448201526064016106c5565b80610ed56114e5565b1015610ef35760405162461bcd60e51b81526004016106c5906127ea565b80600003610f0657610f036114e5565b90505b600c54610e7e906001600160a01b03163383611dd9565b610f25611ed1565b6000600554118015610f38575043600554105b610f845760405162461bcd60e51b815260206004820152601a60248201527f5374616b696e67206861736e277420737461727465642079657400000000000060448201526064016106c5565b6000815111610fd55760405162461bcd60e51b815260206004820152601d60248201527f6d75737420616464206174206c65617374206f6e6520746f6b656e496400000060448201526064016106c5565b600e5481511115610ff85760405162461bcd60e51b81526004016106c590612772565b611000611f2a565b611008611e34565b3360009081526013602052604090208054156110d15760008160020154600254600d54846000015461103a91906127a9565b61104491906127c8565b61104e919061266b565b905080156110cf578061105f6114e5565b101561107d5760405162461bcd60e51b81526004016106c5906127ea565b600c54611094906001600160a01b03163383611dd9565b80601160008282546110a69190612821565b9091555050604051818152339060008051602061296e8339815191529060200160405180910390a25b505b60005b825181101561118c5760008382815181106110f1576110f1612839565b6020908102919091010151600b54604051632142170760e11b81529192506001600160a01b0316906342842e0e9061113190339030908690600401612865565b600060405180830381600087803b15801561114b57600080fd5b505af115801561115f573d6000803e3d6000fd5b5050505060018381018054918201815560009081526020902001558061118481612889565b9150506110d4565b508151815461119b9190612821565b808255600254600d5490916111b091906127a9565b6111ba91906127c8565b600282015581516010546111ce9190612821565b60105560405133907fff409334d2645d660e7cfa41a637aa21f45a79ecb9660a6931aa923bf75577c7906112039085906128a2565b60405180910390a2600f5460ff161561121e5761121e612012565b50610e7e60018055565b611230611d7f565b61123a600061208e565b565b611244611d7f565b6005541561128f5760405162461bcd60e51b8152602060048201526018602482015277141bdbdb081dd85cc8185b1c9958591e481cdd185c9d195960421b60448201526064016106c5565b61129a436064612821565b6005556004546112ad9061191a906127a9565b6005546112ba9190612821565b600681905560055460088190556040517f7cd0ab87d19036f3dfadadb232c78aa4879dda3f0c994a9d637532410ee2ce06926112fd928252602082015260400190565b60405180910390a1565b61130f611d7f565b611317611e34565b60006011546113246114e5565b61132e9190612821565b90506012548111156113bf57601254611347908261266b565b600c5460405163a9059cbb60e01b81529192506001600160a01b03169063a9059cbb9061137a9033908590600401612619565b6020604051808303816000875af1158015611399573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113bd91906128b5565b505b4360068190556040519081527ffed9fcb0ca3d1e761a4b929792bb24082fba92dca81252646ad306d3068065669060200161079c565b6009546001600160a01b0316331461144b5760405162461bcd60e51b815260206004820152601960248201527839b2ba29b2b93b34b1b2a4b733379d102327a92124a22222a760391b60448201526064016106c5565b6001600160a01b0382166114935760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b60448201526064016106c5565b600980546001600160a01b0319166001600160a01b038416179055600a8190556040517f232f2e6280d2064b1e439bf40ecdada042d84eefbb55039e4c49e8dc4f4c90c9906108fc9084908490612619565b600c546040516370a0823160e01b81526000916001600160a01b0316906370a0823190611516903090600401612541565b602060405180830381865afa158015611533573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115579190612600565b905090565b6001600160a01b0381166000908152601360209081526040808320805460019091018054835181860281018601909452808452606094929391928391908301828280156115c857602002820191906000526020600020905b8154815260200190600101908083116115b4575b5050505050905091509150915091565b6115e0611ed1565b3360009081526013602052604090206115f7611f2a565b6115ff611e34565b805460000361160e57506116f6565b60008160020154600254600d54846000015461162a91906127a9565b61163491906127c8565b61163e919061266b565b9050801561169c578061164f6114e5565b101561166d5760405162461bcd60e51b81526004016106c5906127ea565b600c54611684906001600160a01b03163383611dd9565b80601160008282546116969190612821565b90915550505b600254600d5483546116ae91906127a9565b6116b891906127c8565b6002830155604051818152339060008051602061296e8339815191529060200160405180910390a2600f5460ff16156116f3576116f3612012565b50505b61123a60018055565b611707611d7f565b600f805460ff19168215159081179091556040519081527f6c55f8d24f45456d49b15692f6cd375689cbbc2cc46a33366288f1061229c1d39060200161079c565b611750611ed1565b3360009081526013602052604090208054600e548111156117705750600e545b60008167ffffffffffffffff81111561178b5761178b61246d565b6040519080825280602002602001820160405280156117b4578160200160208202803683370190505b50905060005b828110156118b357600180850180546000926117d59161266b565b815481106117e5576117e5612839565b90600052602060002001549050846001018054806118055761180561284f565b600190038181906000526020600020016000905590558083838151811061182e5761182e612839565b6020908102919091010152600b54604051632142170760e11b81526001600160a01b03909116906342842e0e9061186d90309033908690600401612865565b600060405180830381600087803b15801561188757600080fd5b505af115801561189b573d6000803e3d6000fd5b505050505080806118ab90612889565b9150506117ba565b5082546118c190839061266b565b808455600254600d5490916118d691906127a9565b6118e091906127c8565b60028401556010546118f390839061266b565b60105560405133907f1ad6082f7aa3e32095e38fd4c0bf76fa2bb7584e81474cf3519d2dea4081181c906119289084906128a2565b60405180910390a250505061123a60018055565b611944611d7f565b6001600160a01b0381166119a95760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016106c5565b610e7e8161208e565b600080601254905060006011546119c76114e5565b6119d19190612821565b9050600554600003611a0b5761191a6004546007546119f091906127a9565b6119fa91906127a9565b611a049083612821565b9150611a39565b6000611a1b6008546006546120de565b905080600754611a2b91906127a9565b611a359084612821565b9250505b818110611a495760009250505090565b611a53818361266b565b9250505090565b6001600160a01b0381166000908152601360205260408120600d5460085443118015611a8857506000601054115b8015611a9657506000600854115b15611ae7576000611aa9600854436120de565b9050600060075482611abb91906127a9565b905060105460025482611ace91906127a9565b611ad891906127c8565b611ae29084612821565b925050505b60028083015490548354611afc9084906127a9565b611b0691906127c8565b611b10919061266b565b949350505050565b611b20611d7f565b600060055411611b685760405162461bcd60e51b81526020600482015260136024820152721c1bdbdb081a5cc81b9bdd081cdd185c9d1959606a1b60448201526064016106c5565b4360065411611bb55760405162461bcd60e51b81526020600482015260196024820152781c1bdbdb081dd85cc8185b1c9958591e48199a5b9a5cda1959603a1b60448201526064016106c5565b60008111611bf65760405162461bcd60e51b815260206004820152600e60248201526d1a5b9d985b1a5908185b5bdd5b9d60921b60448201526064016106c5565b611bfe611e34565b600c54611c16906001600160a01b031633308461211f565b6000601154611c236114e5565b611c2d9190612821565b9050601254811115611c8c57601254611c46908261266b565b9050600043600654611c58919061266b565b9050611c6481836127c8565b600781905560405190815260008051602061294e8339815191529060200160405180910390a1505b5050565b611c98611d7f565b601e811015611cdf5760405162461bcd60e51b81526020600482015260136024820152721b1bddd95c881b1a5b5a5d081c995858da1959606a1b60448201526064016106c5565b600481905560055415611d4f5761191a600454611cfc91906127a9565b600554611d099190612821565b60068190554310611d4f5760405162461bcd60e51b815260206004820152601060248201526f34b73b30b634b210323ab930ba34b7b760811b60448201526064016106c5565b6040518181527f91abcc2d6823e3a3f11d31b208dd3065d2c6a791f1c7c9fe96a42ce12897eac59060200161079c565b6000546001600160a01b0316331461123a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106c5565b611e2f8363a9059cbb60e01b8484604051602401611df8929190612619565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612146565b505050565b60085443111580611e455750600854155b15611e4c57565b601054600003611e5c5743600855565b6000611e6a600854436120de565b9050600060075482611e7c91906127a9565b905060105460025482611e8f91906127a9565b611e9991906127c8565b600d6000828254611eaa9190612821565b90915550504360085560128054829190600090611ec8908490612821565b90915550505050565b600260015403611f235760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016106c5565b6002600155565b600a54341015611f905760405162461bcd60e51b815260206004820152602b60248201527f73686f756c642070617920736d616c6c2067617320746f20636f6d706f756e6460448201526a081bdc881a185c9d995cdd60aa1b60648201526084016106c5565b600954600a546040516001600160a01b039092169181156108fc0291906000818181858888f19350505050158015611fcc573d6000803e3d6000fd5b50600a5434111561123a57600a5433906108fc90611fea903461266b565b6040518115909202916000818181858888f19350505050158015610e7e573d6000803e3d6000fd5b436006541161201d57565b600060115461202a6114e5565b6120349190612821565b9050601254811115610e7e5760125461204d908261266b565b905060004360065461205f919061266b565b905061206b81836127c8565b600781905560405190815260008051602061294e833981519152906020016108fc565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060065482116120fa576120f3838361266b565b9050612119565b600654831061210b57506000612119565b826006546120f3919061266b565b92915050565b612140846323b872dd60e01b858585604051602401611df893929190612865565b50505050565b600061219b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166122189092919063ffffffff16565b805190915015611e2f57808060200190518101906121b991906128b5565b611e2f5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016106c5565b6060611b10848460008585600080866001600160a01b0316858760405161223f91906128fe565b60006040518083038185875af1925050503d806000811461227c576040519150601f19603f3d011682016040523d82523d6000602084013e612281565b606091505b50915091506122928783838761229d565b979650505050505050565b6060831561230c578251600003612305576001600160a01b0385163b6123055760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016106c5565b5081611b10565b611b1083838151156123215781518083602001fd5b8060405162461bcd60e51b81526004016106c5919061291a565b60006020828403121561234d57600080fd5b5035919050565b6001600160a01b0381168114610e7e57600080fd5b60006020828403121561237b57600080fd5b813561238681612354565b9392505050565b6000806000806000608086880312156123a557600080fd5b85356123b081612354565b945060208601356123c081612354565b935060408601359250606086013567ffffffffffffffff808211156123e457600080fd5b818801915088601f8301126123f857600080fd5b81358181111561240757600080fd5b89602082850101111561241957600080fd5b9699959850939650602001949392505050565b60008060006060848603121561244157600080fd5b833561244c81612354565b9250602084013561245c81612354565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561249657600080fd5b823567ffffffffffffffff808211156124ae57600080fd5b818501915085601f8301126124c257600080fd5b8135818111156124d4576124d461246d565b8060051b604051601f19603f830116810181811085821117156124f9576124f961246d565b60405291825284820192508381018501918883111561251757600080fd5b938501935b828510156125355784358452938501939285019261251c565b98975050505050505050565b6001600160a01b0391909116815260200190565b6000806040838503121561256857600080fd5b823561257381612354565b946020939093013593505050565b600081518084526020808501945080840160005b838110156125b157815187529582019590820190600101612595565b509495945050505050565b828152604060208201526000611b106040830184612581565b8015158114610e7e57600080fd5b6000602082840312156125f557600080fd5b8135612386816125d5565b60006020828403121561261257600080fd5b5051919050565b6001600160a01b03929092168252602082015260400190565b60006020828403121561264457600080fd5b815160ff8116811461238657600080fd5b634e487b7160e01b600052601160045260246000fd5b60008282101561267d5761267d612655565b500390565b600181815b808511156126bd5781600019048211156126a3576126a3612655565b808516156126b057918102915b93841c9390800290612687565b509250929050565b6000826126d457506001612119565b816126e157506000612119565b81600181146126f757600281146127015761271d565b6001915050612119565b60ff84111561271257612712612655565b50506001821b612119565b5060208310610133831016604e8410600b8410161715612740575081810a612119565b61274a8383612682565b806000190482111561275e5761275e612655565b029392505050565b600061238683836126c5565b6020808252601c908201527f63616e6e6f7420657863656564206f6e652d74696d65206c696d697400000000604082015260600190565b60008160001904831182151516156127c3576127c3612655565b500290565b6000826127e557634e487b7160e01b600052601260045260246000fd5b500490565b6020808252601a908201527f496e73756666696369656e742072657761726420746f6b656e73000000000000604082015260600190565b6000821982111561283457612834612655565b500190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b6001600160a01b039384168152919092166020820152604081019190915260600190565b60006001820161289b5761289b612655565b5060010190565b6020815260006123866020830184612581565b6000602082840312156128c757600080fd5b8151612386816125d5565b60005b838110156128ed5781810151838201526020016128d5565b838111156121405750506000910152565b600082516129108184602087016128d2565b9190910192915050565b60208152600082518060208401526129398160408501602087016128d2565b601f01601f1916919091016040019291505056fe0c4d677eef92893ac7ec52faf8140fc6c851ab4736302b4f3a89dfb20696a0df47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d4a2646970667358221220842d7b43ec657e6339b510e18edca0bb0d4b66ee1f79b22e4f3d8ed38fa0fa4164736f6c634300080e0033

Deployed Bytecode

0x6080604052600436106102075760003560e01c806380dc067211610113578063a9f8d181116100ab578063f2fde38b1161006f578063f2fde38b146105e4578063f3aeb31d14610604578063f40f0f5214610619578063f4ef5ed514610639578063f6be71d11461065957600080fd5b8063a9f8d18114610563578063b493877714610579578063b88a802f146105a7578063cd635cce146105af578063db2e21bc146105cf57600080fd5b806380dc06721461048d578063817b1cd2146104a257806381b61948146104b857806387788782146104d85780638ae39cac146104ee5780638da5cb5b146105045780638f662915146105225780639f94e27214610538578063a2cd12d21461054d57600080fd5b80632e1a7d4d116101a157806361d027b31161016557806361d027b3146103f65780636982d815146104235780636e707b7314610443578063715018a614610463578063746c8ae11461047857600080fd5b80632e1a7d4d146103805780633279beab14610393578063392e53cd146103b357806348cd4cb1146103cd578063598b8e71146103e357600080fd5b80626f023114610213578062ae3bf81461023557806301f8a976146102555780630fb5a6b414610275578063150b7a021461029e5780631794bb3c146102d75780631959a002146102f75780631aed655314610340578063249375671461035657600080fd5b3661020e57005b600080fd5b34801561021f57600080fd5b5061023361022e36600461233b565b610679565b005b34801561024157600080fd5b50610233610250366004612369565b6107a7565b34801561026157600080fd5b5061023361027036600461233b565b610908565b34801561028157600080fd5b5061028b60045481565b6040519081526020015b60405180910390f35b3480156102aa57600080fd5b506102be6102b936600461238d565b61093b565b6040516001600160e01b03199091168152602001610295565b3480156102e357600080fd5b506102336102f236600461242c565b61099c565b34801561030357600080fd5b5061032b610312366004612369565b6013602052600090815260409020805460029091015482565b60408051928352602083019190915201610295565b34801561034c57600080fd5b5061028b60065481565b34801561036257600080fd5b50600f546103709060ff1681565b6040519015158152602001610295565b61023361038e36600461233b565b610afc565b34801561039f57600080fd5b506102336103ae36600461233b565b610e81565b3480156103bf57600080fd5b506003546103709060ff1681565b3480156103d957600080fd5b5061028b60055481565b6102336103f1366004612483565b610f1d565b34801561040257600080fd5b50600954610416906001600160a01b031681565b6040516102959190612541565b34801561042f57600080fd5b50600b54610416906001600160a01b031681565b34801561044f57600080fd5b50600c54610416906001600160a01b031681565b34801561046f57600080fd5b50610233611228565b34801561048457600080fd5b5061023361123c565b34801561049957600080fd5b50610233611307565b3480156104ae57600080fd5b5061028b60105481565b3480156104c457600080fd5b506102336104d3366004612555565b6113f5565b3480156104e457600080fd5b5061028b600a5481565b3480156104fa57600080fd5b5061028b60075481565b34801561051057600080fd5b506000546001600160a01b0316610416565b34801561052e57600080fd5b5061028b600d5481565b34801561054457600080fd5b5061028b6114e5565b34801561055957600080fd5b5061028b600e5481565b34801561056f57600080fd5b5061028b60085481565b34801561058557600080fd5b50610599610594366004612369565b61155c565b6040516102959291906125bc565b6102336115d8565b3480156105bb57600080fd5b506102336105ca3660046125e3565b6116ff565b3480156105db57600080fd5b50610233611748565b3480156105f057600080fd5b506102336105ff366004612369565b61193c565b34801561061057600080fd5b5061028b6119b2565b34801561062557600080fd5b5061028b610634366004612369565b611a5a565b34801561064557600080fd5b5061023361065436600461233b565b611b18565b34801561066557600080fd5b5061023361067436600461233b565b611c90565b610681611d7f565b6000600554116106ce5760405162461bcd60e51b8152602060048201526013602482015272141bdbdb081a5cc81b9bdd081cdd185c9d1959606a1b60448201526064015b60405180910390fd5b436006541161071b5760405162461bcd60e51b8152602060048201526019602482015278141bdbdb081dd85cc8185b1c9958591e48199a5b9a5cda1959603a1b60448201526064016106c5565b438111801561072b575060055481115b61076b5760405162461bcd60e51b8152602060048201526011602482015270496e76616c696420656e6420626c6f636b60781b60448201526064016106c5565b60068190556040518181527f0972575658363b3e7c472ab3a6a918726742c853b732f6a4a2763e2e3a94c977906020015b60405180910390a150565b6107af611d7f565b600c546001600160a01b03908116908216036108065760405162461bcd60e51b815260206004820152601660248201527521b0b73737ba103132903932bbb0b932103a37b5b2b760511b60448201526064016106c5565b476001600160a01b03821661084857604051339082156108fc029083906000818181858888f19350505050158015610842573d6000803e3d6000fd5b506108cb565b6040516370a0823160e01b81526001600160a01b038316906370a0823190610874903090600401612541565b602060405180830381865afa158015610891573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108b59190612600565b90506108cb6001600160a01b0383163383611dd9565b7f74f5dcd55c394cb1c6d3b9da22c2464bcc46c38cc3865bd629ed75823249b40b82826040516108fc929190612619565b60405180910390a15050565b610910611d7f565b610918611e34565b600781905560405181815260008051602061294e8339815191529060200161079c565b600b546000906001600160a01b0316331461098a5760405162461bcd60e51b815260206004820152600f60248201526e1b9bdd08195b98589b195908139195608a1b60448201526064016106c5565b50630a85bd0160e11b95945050505050565b6109a4611d7f565b60035460ff16156109ed5760405162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481a5b9a5d1a585b1a5e9959606a1b60448201526064016106c5565b6003805460ff19166001179055600b80546001600160a01b038086166001600160a01b031992831617909255600c8054928516929091168217905560078290556040805163313ce56760e01b815290516000929163313ce5679160048281019260209291908290030181865afa158015610a6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8f9190612632565b60ff169050601e8110610add5760405162461bcd60e51b815260206004820152601660248201527504d75737420626520696e666572696f7220746f2033360541b60448201526064016106c5565b610ae881602861266b565b610af390600a612766565b60025550505050565b610b04611ed1565b60008111610b545760405162461bcd60e51b815260206004820152601f60248201527f416d6f756e742073686f756c642062652067726561746f72207468616e20300060448201526064016106c5565b600e54811115610b765760405162461bcd60e51b81526004016106c590612772565b3360009081526013602052604090208054821115610bd65760405162461bcd60e51b815260206004820152601b60248201527f416d6f756e7420746f20776974686472617720746f6f2068696768000000000060448201526064016106c5565b610bde611f2a565b610be6611e34565b805415610ca05760008160020154600254600d548460000154610c0991906127a9565b610c1391906127c8565b610c1d919061266b565b90508015610c9e5780610c2e6114e5565b1015610c4c5760405162461bcd60e51b81526004016106c5906127ea565b600c54610c63906001600160a01b03163383611dd9565b8060116000828254610c759190612821565b9091555050604051818152339060008051602061296e8339815191529060200160405180910390a25b505b60008267ffffffffffffffff811115610cbb57610cbb61246d565b604051908082528060200260200182016040528015610ce4578160200160208202803683370190505b50905060005b83811015610de35760018084018054600092610d059161266b565b81548110610d1557610d15612839565b9060005260206000200154905083600101805480610d3557610d3561284f565b6001900381819060005260206000200160009055905580838381518110610d5e57610d5e612839565b6020908102919091010152600b54604051632142170760e11b81526001600160a01b03909116906342842e0e90610d9d90309033908690600401612865565b600060405180830381600087803b158015610db757600080fd5b505af1158015610dcb573d6000803e3d6000fd5b50505050508080610ddb90612889565b915050610cea565b508154610df190849061266b565b808355600254600d549091610e0691906127a9565b610e1091906127c8565b6002830155601054610e2390849061266b565b60105560405133907f67e9df8b3c7743c9f1b625ba4f2b4e601206dbd46ed5c33c85a1242e4d23a2d190610e589084906128a2565b60405180910390a2600f5460ff1615610e7357610e73612012565b5050610e7e60018055565b50565b610e89611d7f565b6006544311610ecc5760405162461bcd60e51b815260206004820152600f60248201526e506f6f6c2069732072756e6e696e6760881b60448201526064016106c5565b80610ed56114e5565b1015610ef35760405162461bcd60e51b81526004016106c5906127ea565b80600003610f0657610f036114e5565b90505b600c54610e7e906001600160a01b03163383611dd9565b610f25611ed1565b6000600554118015610f38575043600554105b610f845760405162461bcd60e51b815260206004820152601a60248201527f5374616b696e67206861736e277420737461727465642079657400000000000060448201526064016106c5565b6000815111610fd55760405162461bcd60e51b815260206004820152601d60248201527f6d75737420616464206174206c65617374206f6e6520746f6b656e496400000060448201526064016106c5565b600e5481511115610ff85760405162461bcd60e51b81526004016106c590612772565b611000611f2a565b611008611e34565b3360009081526013602052604090208054156110d15760008160020154600254600d54846000015461103a91906127a9565b61104491906127c8565b61104e919061266b565b905080156110cf578061105f6114e5565b101561107d5760405162461bcd60e51b81526004016106c5906127ea565b600c54611094906001600160a01b03163383611dd9565b80601160008282546110a69190612821565b9091555050604051818152339060008051602061296e8339815191529060200160405180910390a25b505b60005b825181101561118c5760008382815181106110f1576110f1612839565b6020908102919091010151600b54604051632142170760e11b81529192506001600160a01b0316906342842e0e9061113190339030908690600401612865565b600060405180830381600087803b15801561114b57600080fd5b505af115801561115f573d6000803e3d6000fd5b5050505060018381018054918201815560009081526020902001558061118481612889565b9150506110d4565b508151815461119b9190612821565b808255600254600d5490916111b091906127a9565b6111ba91906127c8565b600282015581516010546111ce9190612821565b60105560405133907fff409334d2645d660e7cfa41a637aa21f45a79ecb9660a6931aa923bf75577c7906112039085906128a2565b60405180910390a2600f5460ff161561121e5761121e612012565b50610e7e60018055565b611230611d7f565b61123a600061208e565b565b611244611d7f565b6005541561128f5760405162461bcd60e51b8152602060048201526018602482015277141bdbdb081dd85cc8185b1c9958591e481cdd185c9d195960421b60448201526064016106c5565b61129a436064612821565b6005556004546112ad9061191a906127a9565b6005546112ba9190612821565b600681905560055460088190556040517f7cd0ab87d19036f3dfadadb232c78aa4879dda3f0c994a9d637532410ee2ce06926112fd928252602082015260400190565b60405180910390a1565b61130f611d7f565b611317611e34565b60006011546113246114e5565b61132e9190612821565b90506012548111156113bf57601254611347908261266b565b600c5460405163a9059cbb60e01b81529192506001600160a01b03169063a9059cbb9061137a9033908590600401612619565b6020604051808303816000875af1158015611399573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113bd91906128b5565b505b4360068190556040519081527ffed9fcb0ca3d1e761a4b929792bb24082fba92dca81252646ad306d3068065669060200161079c565b6009546001600160a01b0316331461144b5760405162461bcd60e51b815260206004820152601960248201527839b2ba29b2b93b34b1b2a4b733379d102327a92124a22222a760391b60448201526064016106c5565b6001600160a01b0382166114935760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b60448201526064016106c5565b600980546001600160a01b0319166001600160a01b038416179055600a8190556040517f232f2e6280d2064b1e439bf40ecdada042d84eefbb55039e4c49e8dc4f4c90c9906108fc9084908490612619565b600c546040516370a0823160e01b81526000916001600160a01b0316906370a0823190611516903090600401612541565b602060405180830381865afa158015611533573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115579190612600565b905090565b6001600160a01b0381166000908152601360209081526040808320805460019091018054835181860281018601909452808452606094929391928391908301828280156115c857602002820191906000526020600020905b8154815260200190600101908083116115b4575b5050505050905091509150915091565b6115e0611ed1565b3360009081526013602052604090206115f7611f2a565b6115ff611e34565b805460000361160e57506116f6565b60008160020154600254600d54846000015461162a91906127a9565b61163491906127c8565b61163e919061266b565b9050801561169c578061164f6114e5565b101561166d5760405162461bcd60e51b81526004016106c5906127ea565b600c54611684906001600160a01b03163383611dd9565b80601160008282546116969190612821565b90915550505b600254600d5483546116ae91906127a9565b6116b891906127c8565b6002830155604051818152339060008051602061296e8339815191529060200160405180910390a2600f5460ff16156116f3576116f3612012565b50505b61123a60018055565b611707611d7f565b600f805460ff19168215159081179091556040519081527f6c55f8d24f45456d49b15692f6cd375689cbbc2cc46a33366288f1061229c1d39060200161079c565b611750611ed1565b3360009081526013602052604090208054600e548111156117705750600e545b60008167ffffffffffffffff81111561178b5761178b61246d565b6040519080825280602002602001820160405280156117b4578160200160208202803683370190505b50905060005b828110156118b357600180850180546000926117d59161266b565b815481106117e5576117e5612839565b90600052602060002001549050846001018054806118055761180561284f565b600190038181906000526020600020016000905590558083838151811061182e5761182e612839565b6020908102919091010152600b54604051632142170760e11b81526001600160a01b03909116906342842e0e9061186d90309033908690600401612865565b600060405180830381600087803b15801561188757600080fd5b505af115801561189b573d6000803e3d6000fd5b505050505080806118ab90612889565b9150506117ba565b5082546118c190839061266b565b808455600254600d5490916118d691906127a9565b6118e091906127c8565b60028401556010546118f390839061266b565b60105560405133907f1ad6082f7aa3e32095e38fd4c0bf76fa2bb7584e81474cf3519d2dea4081181c906119289084906128a2565b60405180910390a250505061123a60018055565b611944611d7f565b6001600160a01b0381166119a95760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016106c5565b610e7e8161208e565b600080601254905060006011546119c76114e5565b6119d19190612821565b9050600554600003611a0b5761191a6004546007546119f091906127a9565b6119fa91906127a9565b611a049083612821565b9150611a39565b6000611a1b6008546006546120de565b905080600754611a2b91906127a9565b611a359084612821565b9250505b818110611a495760009250505090565b611a53818361266b565b9250505090565b6001600160a01b0381166000908152601360205260408120600d5460085443118015611a8857506000601054115b8015611a9657506000600854115b15611ae7576000611aa9600854436120de565b9050600060075482611abb91906127a9565b905060105460025482611ace91906127a9565b611ad891906127c8565b611ae29084612821565b925050505b60028083015490548354611afc9084906127a9565b611b0691906127c8565b611b10919061266b565b949350505050565b611b20611d7f565b600060055411611b685760405162461bcd60e51b81526020600482015260136024820152721c1bdbdb081a5cc81b9bdd081cdd185c9d1959606a1b60448201526064016106c5565b4360065411611bb55760405162461bcd60e51b81526020600482015260196024820152781c1bdbdb081dd85cc8185b1c9958591e48199a5b9a5cda1959603a1b60448201526064016106c5565b60008111611bf65760405162461bcd60e51b815260206004820152600e60248201526d1a5b9d985b1a5908185b5bdd5b9d60921b60448201526064016106c5565b611bfe611e34565b600c54611c16906001600160a01b031633308461211f565b6000601154611c236114e5565b611c2d9190612821565b9050601254811115611c8c57601254611c46908261266b565b9050600043600654611c58919061266b565b9050611c6481836127c8565b600781905560405190815260008051602061294e8339815191529060200160405180910390a1505b5050565b611c98611d7f565b601e811015611cdf5760405162461bcd60e51b81526020600482015260136024820152721b1bddd95c881b1a5b5a5d081c995858da1959606a1b60448201526064016106c5565b600481905560055415611d4f5761191a600454611cfc91906127a9565b600554611d099190612821565b60068190554310611d4f5760405162461bcd60e51b815260206004820152601060248201526f34b73b30b634b210323ab930ba34b7b760811b60448201526064016106c5565b6040518181527f91abcc2d6823e3a3f11d31b208dd3065d2c6a791f1c7c9fe96a42ce12897eac59060200161079c565b6000546001600160a01b0316331461123a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106c5565b611e2f8363a9059cbb60e01b8484604051602401611df8929190612619565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612146565b505050565b60085443111580611e455750600854155b15611e4c57565b601054600003611e5c5743600855565b6000611e6a600854436120de565b9050600060075482611e7c91906127a9565b905060105460025482611e8f91906127a9565b611e9991906127c8565b600d6000828254611eaa9190612821565b90915550504360085560128054829190600090611ec8908490612821565b90915550505050565b600260015403611f235760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016106c5565b6002600155565b600a54341015611f905760405162461bcd60e51b815260206004820152602b60248201527f73686f756c642070617920736d616c6c2067617320746f20636f6d706f756e6460448201526a081bdc881a185c9d995cdd60aa1b60648201526084016106c5565b600954600a546040516001600160a01b039092169181156108fc0291906000818181858888f19350505050158015611fcc573d6000803e3d6000fd5b50600a5434111561123a57600a5433906108fc90611fea903461266b565b6040518115909202916000818181858888f19350505050158015610e7e573d6000803e3d6000fd5b436006541161201d57565b600060115461202a6114e5565b6120349190612821565b9050601254811115610e7e5760125461204d908261266b565b905060004360065461205f919061266b565b905061206b81836127c8565b600781905560405190815260008051602061294e833981519152906020016108fc565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060065482116120fa576120f3838361266b565b9050612119565b600654831061210b57506000612119565b826006546120f3919061266b565b92915050565b612140846323b872dd60e01b858585604051602401611df893929190612865565b50505050565b600061219b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166122189092919063ffffffff16565b805190915015611e2f57808060200190518101906121b991906128b5565b611e2f5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016106c5565b6060611b10848460008585600080866001600160a01b0316858760405161223f91906128fe565b60006040518083038185875af1925050503d806000811461227c576040519150601f19603f3d011682016040523d82523d6000602084013e612281565b606091505b50915091506122928783838761229d565b979650505050505050565b6060831561230c578251600003612305576001600160a01b0385163b6123055760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016106c5565b5081611b10565b611b1083838151156123215781518083602001fd5b8060405162461bcd60e51b81526004016106c5919061291a565b60006020828403121561234d57600080fd5b5035919050565b6001600160a01b0381168114610e7e57600080fd5b60006020828403121561237b57600080fd5b813561238681612354565b9392505050565b6000806000806000608086880312156123a557600080fd5b85356123b081612354565b945060208601356123c081612354565b935060408601359250606086013567ffffffffffffffff808211156123e457600080fd5b818801915088601f8301126123f857600080fd5b81358181111561240757600080fd5b89602082850101111561241957600080fd5b9699959850939650602001949392505050565b60008060006060848603121561244157600080fd5b833561244c81612354565b9250602084013561245c81612354565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561249657600080fd5b823567ffffffffffffffff808211156124ae57600080fd5b818501915085601f8301126124c257600080fd5b8135818111156124d4576124d461246d565b8060051b604051601f19603f830116810181811085821117156124f9576124f961246d565b60405291825284820192508381018501918883111561251757600080fd5b938501935b828510156125355784358452938501939285019261251c565b98975050505050505050565b6001600160a01b0391909116815260200190565b6000806040838503121561256857600080fd5b823561257381612354565b946020939093013593505050565b600081518084526020808501945080840160005b838110156125b157815187529582019590820190600101612595565b509495945050505050565b828152604060208201526000611b106040830184612581565b8015158114610e7e57600080fd5b6000602082840312156125f557600080fd5b8135612386816125d5565b60006020828403121561261257600080fd5b5051919050565b6001600160a01b03929092168252602082015260400190565b60006020828403121561264457600080fd5b815160ff8116811461238657600080fd5b634e487b7160e01b600052601160045260246000fd5b60008282101561267d5761267d612655565b500390565b600181815b808511156126bd5781600019048211156126a3576126a3612655565b808516156126b057918102915b93841c9390800290612687565b509250929050565b6000826126d457506001612119565b816126e157506000612119565b81600181146126f757600281146127015761271d565b6001915050612119565b60ff84111561271257612712612655565b50506001821b612119565b5060208310610133831016604e8410600b8410161715612740575081810a612119565b61274a8383612682565b806000190482111561275e5761275e612655565b029392505050565b600061238683836126c5565b6020808252601c908201527f63616e6e6f7420657863656564206f6e652d74696d65206c696d697400000000604082015260600190565b60008160001904831182151516156127c3576127c3612655565b500290565b6000826127e557634e487b7160e01b600052601260045260246000fd5b500490565b6020808252601a908201527f496e73756666696369656e742072657761726420746f6b656e73000000000000604082015260600190565b6000821982111561283457612834612655565b500190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b6001600160a01b039384168152919092166020820152604081019190915260600190565b60006001820161289b5761289b612655565b5060010190565b6020815260006123866020830184612581565b6000602082840312156128c757600080fd5b8151612386816125d5565b60005b838110156128ed5781810151838201526020016128d5565b838111156121405750506000910152565b600082516129108184602087016128d2565b9190910192915050565b60208152600082518060208401526129398160408501602087016128d2565b601f01601f1916919091016040019291505056fe0c4d677eef92893ac7ec52faf8140fc6c851ab4736302b4f3a89dfb20696a0df47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d4a2646970667358221220842d7b43ec657e6339b510e18edca0bb0d4b66ee1f79b22e4f3d8ed38fa0fa4164736f6c634300080e0033

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
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.