ETH Price: $1,978.30 (-5.25%)

Contract

0x9D1D148193C296DBCb7056C4Ec0BC1445e3fADFb
 

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
Unstake209607372024-10-14 2:10:23508 days ago1728871823IN
0x9D1D1481...45e3fADFb
0 ETH0.001442767.5
Unstake201996812024-06-29 20:18:47615 days ago1719692327IN
0x9D1D1481...45e3fADFb
0 ETH0.001426912.06747165
Unstake201767442024-06-26 15:24:59618 days ago1719415499IN
0x9D1D1481...45e3fADFb
0 ETH0.0067024912.80119926
Unstake201037152024-06-16 10:20:11628 days ago1718533211IN
0x9D1D1481...45e3fADFb
0 ETH0.001316253.85764203
Unstake200211412024-06-04 21:27:35640 days ago1717536455IN
0x9D1D1481...45e3fADFb
0 ETH0.002303911.01244616
Unstake200132792024-06-03 19:07:35641 days ago1717441655IN
0x9D1D1481...45e3fADFb
0 ETH0.0023674112.32328816
Unstake199462252024-05-25 10:14:11650 days ago1716632051IN
0x9D1D1481...45e3fADFb
0 ETH0.000646064.44636282
Unstake197221962024-04-24 2:15:11681 days ago1713924911IN
0x9D1D1481...45e3fADFb
0 ETH0.00172279.58754891
Unstake197221822024-04-24 2:12:23681 days ago1713924743IN
0x9D1D1481...45e3fADFb
0 ETH0.0020170410.25021375
Unstake197220412024-04-24 1:43:35681 days ago1713923015IN
0x9D1D1481...45e3fADFb
0 ETH0.0026192612.51985598
Unstake197087182024-04-22 5:01:23683 days ago1713762083IN
0x9D1D1481...45e3fADFb
0 ETH0.00270475.89741509
Unstake197035732024-04-21 11:47:11684 days ago1713700031IN
0x9D1D1481...45e3fADFb
0 ETH0.009052636.73292299
Unstake196963302024-04-20 11:28:59685 days ago1713612539IN
0x9D1D1481...45e3fADFb
0 ETH0.001965176.32748156
Unstake196202102024-04-09 19:36:59696 days ago1712691419IN
0x9D1D1481...45e3fADFb
0 ETH0.0048330823.10171655
Unstake195876212024-04-05 6:00:59700 days ago1712296859IN
0x9D1D1481...45e3fADFb
0 ETH0.0351271713.67569671
Unstake194979172024-03-23 14:32:59713 days ago1711204379IN
0x9D1D1481...45e3fADFb
0 ETH0.0114462721.95489062
Unstake194903702024-03-22 13:09:59714 days ago1711112999IN
0x9D1D1481...45e3fADFb
0 ETH0.0112666824.45949821
Unstake194827282024-03-21 11:24:59715 days ago1711020299IN
0x9D1D1481...45e3fADFb
0 ETH0.0038420226.4418175
Unstake194317852024-03-14 7:32:23722 days ago1710401543IN
0x9D1D1481...45e3fADFb
0 ETH0.0128162949
Unstake193306182024-02-29 3:52:59736 days ago1709178779IN
0x9D1D1481...45e3fADFb
0 ETH0.043336650.55488528
Unstake193188062024-02-27 12:11:47738 days ago1709035907IN
0x9D1D1481...45e3fADFb
0 ETH0.0150160638.28421549
Unstake192823692024-02-22 9:49:35743 days ago1708595375IN
0x9D1D1481...45e3fADFb
0 ETH0.0056734132.41785949
Unstake192823002024-02-22 9:35:23743 days ago1708594523IN
0x9D1D1481...45e3fADFb
0 ETH0.0087503633.22272253
Unstake192784902024-02-21 20:45:11744 days ago1708548311IN
0x9D1D1481...45e3fADFb
0 ETH0.0250062738.65267402
Unstake192784062024-02-21 20:28:11744 days ago1708547291IN
0x9D1D1481...45e3fADFb
0 ETH0.0379363830.95940459
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
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:
NftStaking

Compiler Version
v0.8.14+commit.80d49f37

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
//SPDX-License-Identifier: Unlicense
pragma solidity 0.8.14;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "./INftStaking.sol";

contract NftStaking is INftStaking, IERC721Receiver, AccessControl {
  using SafeERC20 for IERC20;
  using EnumerableSet for EnumerableSet.AddressSet;
  using EnumerableSet for EnumerableSet.UintSet;

  IERC20 private rewardToken;

  mapping(PlanId => Plan) private plans;
  EnumerableSet.AddressSet private whitelistedNFTs;
  mapping(address => RewardPeriod[]) private whitelistedNFTRewards;
  mapping(address => mapping(uint256 => NFTStake)) private stakes;

  mapping(address => mapping(address => EnumerableSet.UintSet))
    private userNFTs;

  uint256 private withdrawTimestamp;

  constructor(IERC20 _rewardToken, address _admin) {
    _initPlans();
    rewardToken = _rewardToken;

    _setupRole(DEFAULT_ADMIN_ROLE, _admin);
  }

  /**
   * @dev Returns all user stakes
   */
  function getUserStakes(address user)
    external
    view
    returns (UserNFTStake[] memory nftStakes)
  {
    uint256 count;

    for (uint256 i = 0; i < whitelistedNFTs.length(); i++) {
      address nftContract = whitelistedNFTs.at(i);
      count += userNFTs[user][nftContract].length();
    }

    nftStakes = new UserNFTStake[](count);
    uint256 stakeIndex;

    for (uint256 i = 0; i < whitelistedNFTs.length(); i++) {
      address nftContract = whitelistedNFTs.at(i);
      for (uint256 j = 0; j < userNFTs[user][nftContract].length(); j++) {
        uint256 tokenId = userNFTs[user][nftContract].at(j);
        NFTStake memory nftStake = stakes[nftContract][tokenId];
        nftStakes[stakeIndex++] = UserNFTStake(
          nftContract,
          tokenId,
          nftStake.planId,
          nftStake.stakedAt,
          nftStake.unstakedAt,
          nftStake.rewardClaimed
        );
      }
    }

    return nftStakes;
  }

  /**
   * @dev Returns all whitelisted contracts and their rewardRates
   */
  function getWhitelistedContracts()
    external
    view
    returns (WhitelistedContract[] memory whitelistedContracts)
  {
    whitelistedContracts = new WhitelistedContract[](whitelistedNFTs.length());

    for (uint256 i = 0; i < whitelistedNFTs.length(); i++) {
      address nftContract = whitelistedNFTs.at(i);
      whitelistedContracts[i] = WhitelistedContract(
        nftContract,
        whitelistedNFTRewards[nftContract]
      );
    }

    return whitelistedContracts;
  }

  /**
   * @dev Allows user to stake multiple nft-s
   */
  function stake(NFTWithPlanId[] calldata nfts) external {
    for (uint256 i = 0; i < nfts.length; i = unsafe_inc(i)) {
      _stake(nfts[i].nftContract, nfts[i].tokenId, nfts[i].planId);
    }
  }

  /**
   * @dev Allows user to check reward for his NFT
   */
  function getReward(NFT calldata nft) external view returns (uint256) {
    return _getReward(nft.nftContract, nft.tokenId);
  }

  /**
   * @dev Allows user to claim rewards for nft-s
   */
  function claimRewards(NFT[] calldata nfts) external {
    for (uint256 i = 0; i < nfts.length; i++) {
      _claimRewards(nfts[i].nftContract, nfts[i].tokenId);
    }
  }

  /**
   * @dev Allows user to claim rewards for nft-s
   */
  function unstake(NFT[] calldata nfts) external {
    for (uint256 i = 0; i < nfts.length; i++) {
      _unstake(nfts[i].nftContract, nfts[i].tokenId);
    }
  }

  /**
   * @dev Allows default admin to set dailyReward for nftContract
   */
  function setDailyReward(address nftContract, uint256 dailyReward)
    external
    onlyRole(DEFAULT_ADMIN_ROLE)
  {
    whitelistedNFTs.add(nftContract);
    whitelistedNFTRewards[nftContract].push(
      RewardPeriod(dailyReward, block.timestamp)
    );
  }

  /**
   * @dev Allows admin to announce withdraw 30 days before
   */
  function announceWithdraw() external onlyRole(DEFAULT_ADMIN_ROLE) {
    require(withdrawTimestamp == 0, "Already announced");

    withdrawTimestamp = block.timestamp + 30 days;
    emit WithdrawAnnounced(withdrawTimestamp);
  }

  /**
   * @dev Allows admin to cancel withdraw announcement
   */
  function cancelWithdraw() external onlyRole(DEFAULT_ADMIN_ROLE) {
    withdrawTimestamp = 0;
    emit WithdrawCancelled();
  }

  /**
   * @dev Allows admin to withdraw rewardToken funds 30 days after withdraw announcement
   */
  function withdraw(address recipient) external onlyRole(DEFAULT_ADMIN_ROLE) {
    require(
      withdrawTimestamp > 0 && withdrawTimestamp < block.timestamp,
      "Can only withdraw 30 days after announcement"
    );

    uint256 amount = rewardToken.balanceOf(address(this));

    rewardToken.safeTransfer(recipient, amount);

    emit Withdrawn(amount);
  }

  // ---------------------------------------------------

  function _stake(
    address nftContract,
    uint256 tokenId,
    PlanId planId
  ) private {
    // check if contract is whitelisted
    require(
      whitelistedNFTs.contains(nftContract),
      "NFT contract not whitelisted"
    );

    // transfer nft here
    IERC721(nftContract).safeTransferFrom(msg.sender, address(this), tokenId);

    userNFTs[msg.sender][nftContract].add(tokenId);

    stakes[nftContract][tokenId] = NFTStake(
      msg.sender,
      planId,
      uint64(block.timestamp),
      0,
      0
    );

    emit Staked(msg.sender, planId, nftContract, tokenId);
  }

  function _getReward(address nftContract, uint256 tokenId)
    private
    view
    returns (uint256)
  {
    NFTStake storage nftStake = stakes[nftContract][tokenId];

    RewardPeriod[] memory rewardPeriods = whitelistedNFTRewards[nftContract];

    uint256 reward;

    for (uint256 i = 0; i < rewardPeriods.length; i = unsafe_inc(i)) {
      uint256 startTime = Math.max(
        nftStake.stakedAt,
        rewardPeriods[i].validFrom
      );

      uint256 endTime = i == rewardPeriods.length - 1
        ? block.timestamp
        : rewardPeriods[i + 1].validFrom;

      if (nftStake.unstakedAt > 0) {
        endTime = Math.min(nftStake.unstakedAt, endTime);
      }

      uint256 timeStaked = endTime - startTime;

      reward += ((timeStaked *
        rewardPeriods[i].dailyReward *
        plans[nftStake.planId].dailyRewardPercentage) / 100 days);
    }

    return reward - nftStake.rewardClaimed;
  }

  function _claimRewards(address nftContract, uint256 tokenId) private {
    NFTStake storage nftStake = stakes[nftContract][tokenId];

    require(nftStake.user == msg.sender, "Not owner of this NFT");

    uint256 amount = _getReward(nftContract, tokenId);

    nftStake.rewardClaimed += amount;

    rewardToken.safeTransfer(nftStake.user, amount);

    emit RewardClaimed(
      nftStake.user,
      nftStake.planId,
      nftContract,
      tokenId,
      amount
    );
  }

  function _unstake(address nftContract, uint256 tokenId) private {
    NFTStake storage nftStake = stakes[nftContract][tokenId];

    require(nftStake.user == msg.sender, "Not owner of this NFT");
    require(nftStake.unstakedAt == 0, "NFT already unstaked");
    require(
      nftStake.stakedAt + plans[nftStake.planId].lockDuration < block.timestamp,
      "Cannot unstake yet"
    );

    nftStake.unstakedAt = uint64(block.timestamp);

    userNFTs[msg.sender][nftContract].remove(tokenId);

    // claim rewards
    _claimRewards(nftContract, tokenId);

    // transfer nft back to user
    IERC721(nftContract).safeTransferFrom(
      address(this),
      nftStake.user,
      tokenId
    );

    emit Unstaked(nftStake.user, nftStake.planId, nftContract, tokenId);
  }

  /**
   * @dev Inits the plans
   */
  function _initPlans() private {
    plans[PlanId.plan0monthsLock] = Plan(0, 100);
    plans[PlanId.plan1monthsLock] = Plan(30 days, 115);
    plans[PlanId.plan3monthsLock] = Plan(90 days, 150);
    plans[PlanId.plan6monthsLock] = Plan(180 days, 200);
  }

  /**
   * @dev Allows safe transfers to this contract address
   */
  function onERC721Received(
    address,
    address,
    uint256,
    bytes calldata
  ) external pure override returns (bytes4) {
    return this.onERC721Received.selector;
  }

  /**
   * @dev Spares tiny bit of gas
   */
  function unsafe_inc(uint256 n) private pure returns (uint256) {
    unchecked {
      return n + 1;
    }
  }
}

// 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 v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

File 4 of 15 : 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.6.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 be 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: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

            return true;
        } else {
            return false;
        }
    }

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

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

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

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

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

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

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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

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

        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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

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

        assembly {
            result := store
        }

        return result;
    }
}

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

pragma solidity ^0.8.0;

import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `_msgSender()` is missing `role`.
     * Overriding this function changes the behavior of the {onlyRole} modifier.
     *
     * Format of the revert message is described in {_checkRole}.
     *
     * _Available since v4.6._
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(uint160(account), 20),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

File 9 of 15 : INftStaking.sol
// SPDX-License-Identifier: Unlicense

pragma solidity ^0.8.0;

interface INftStaking {
  enum PlanId {
    plan0monthsLock,
    plan1monthsLock,
    plan3monthsLock,
    plan6monthsLock
  }

  struct RewardPeriod {
    uint256 dailyReward;
    uint256 validFrom;
  }

  struct Plan {
    uint64 lockDuration;
    uint16 dailyRewardPercentage;
  }

  struct NFT {
    address nftContract;
    uint256 tokenId;
  }

  struct NFTWithPlanId {
    address nftContract;
    uint256 tokenId;
    PlanId planId;
  }

  struct NFTStake {
    address user;
    PlanId planId;
    uint64 stakedAt;
    uint64 unstakedAt;
    uint256 rewardClaimed;
  }

  struct UserNFTStake {
    address nftContract;
    uint256 tokenId;
    PlanId planId;
    uint64 stakedAt;
    uint64 unstakedAt;
    uint256 rewardClaimed;
  }

  struct WhitelistedContract {
    address contractAddress;
    RewardPeriod[] rewardPeriods;
  }

  event Staked(
    address indexed user,
    PlanId planId,
    address nftContract,
    uint256 tokenId
  );

  event Unstaked(
    address indexed user,
    PlanId planId,
    address nftContract,
    uint256 tokenId
  );

  event RewardClaimed(
    address indexed user,
    PlanId planId,
    address indexed nftContract,
    uint256 indexed tokenId,
    uint256 amount
  );

  event WithdrawAnnounced(uint256 timestamp);
  event WithdrawCancelled();
  event Withdrawn(uint256 amount);
}

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

// 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/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"contract IERC20","name":"_rewardToken","type":"address"},{"internalType":"address","name":"_admin","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"enum INftStaking.PlanId","name":"planId","type":"uint8"},{"indexed":true,"internalType":"address","name":"nftContract","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RewardClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"enum INftStaking.PlanId","name":"planId","type":"uint8"},{"indexed":false,"internalType":"address","name":"nftContract","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"enum INftStaking.PlanId","name":"planId","type":"uint8"},{"indexed":false,"internalType":"address","name":"nftContract","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Unstaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"WithdrawAnnounced","type":"event"},{"anonymous":false,"inputs":[],"name":"WithdrawCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"announceWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"cancelWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct INftStaking.NFT[]","name":"nfts","type":"tuple[]"}],"name":"claimRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct INftStaking.NFT","name":"nft","type":"tuple"}],"name":"getReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getUserStakes","outputs":[{"components":[{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"enum INftStaking.PlanId","name":"planId","type":"uint8"},{"internalType":"uint64","name":"stakedAt","type":"uint64"},{"internalType":"uint64","name":"unstakedAt","type":"uint64"},{"internalType":"uint256","name":"rewardClaimed","type":"uint256"}],"internalType":"struct INftStaking.UserNFTStake[]","name":"nftStakes","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getWhitelistedContracts","outputs":[{"components":[{"internalType":"address","name":"contractAddress","type":"address"},{"components":[{"internalType":"uint256","name":"dailyReward","type":"uint256"},{"internalType":"uint256","name":"validFrom","type":"uint256"}],"internalType":"struct INftStaking.RewardPeriod[]","name":"rewardPeriods","type":"tuple[]"}],"internalType":"struct INftStaking.WhitelistedContract[]","name":"whitelistedContracts","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":"pure","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"uint256","name":"dailyReward","type":"uint256"}],"name":"setDailyReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"enum INftStaking.PlanId","name":"planId","type":"uint8"}],"internalType":"struct INftStaking.NFTWithPlanId[]","name":"nfts","type":"tuple[]"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct INftStaking.NFT[]","name":"nfts","type":"tuple[]"}],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b5060405162002585380380620025858339810160408190526200003491620002ae565b620001b5604080518082018252600080825260646020808401918252828052600280825293517fac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077b8054935161ffff908116680100000000000000009081026001600160501b03199687166001600160401b0395861617179092558751808901895262278d00815260738186019081526001885288865290517fe90b7bceb6e7df5418fb78d8ee546e97c83a08bbccc01a0644d599ccd2a7c2e0805492518416850292881691861691909117919091179055875180890189526276a7008152609681860190815288885288865290517f679795a0195a1b76cdebb7c51d74e058aee92919b8c3389af86ef24535e8a28c805492518416850292881691861691909117919091179055875180890190985262ed4e00885260c888850190815260039096529590925294517f88601476d11616a71c5be67555bd1dff4b1cbf21533d2669b768b61518cfe1c380549451919096169390921692909217921602179055565b600180546001600160a01b0319166001600160a01b038416179055620001dd600082620001e5565b5050620002ed565b620001f18282620001f5565b5050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16620001f1576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620002513390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6001600160a01b0381168114620002ab57600080fd5b50565b60008060408385031215620002c257600080fd5b8251620002cf8162000295565b6020840151909250620002e28162000295565b809150509250929050565b61228880620002fd6000396000f3fe608060405234801561001057600080fd5b50600436106101165760003560e01c80637e47daa1116100a257806394d8d7e91161007157806394d8d7e914610265578063a217fddf14610278578063af7ec6cb14610280578063d547741f14610293578063e7c6c2e5146102a657600080fd5b80637e47daa114610215578063842e29811461022a57806384b768241461024a57806391d148541461025257600080fd5b80632f2ff15d116100e95780632f2ff15d146101c157806336568abe146101d457806351cff8d9146101e75780636ee787d8146101fa57806374b0f4e51461020257600080fd5b806301ffc9a71461011b578063150b7a021461014357806316f2f70f1461017b578063248a9ca314610190575b600080fd5b61012e610129366004611bbf565b6102b9565b60405190151581526020015b60405180910390f35b610162610151366004611c05565b630a85bd0160e11b95945050505050565b6040516001600160e01b0319909116815260200161013a565b61018e610189366004611c9f565b6102f0565b005b6101b361019e366004611cc9565b60009081526020819052604090206001015490565b60405190815260200161013a565b61018e6101cf366004611ce2565b610358565b61018e6101e2366004611ce2565b610382565b61018e6101f5366004611d0e565b610405565b61018e610543565b61018e610210366004611d29565b6105da565b61021d610663565b60405161013a9190611d9d565b61023d610238366004611d0e565b6107b8565b60405161013a9190611e87565b61018e610aa5565b61012e610260366004611ce2565b610ae1565b61018e610273366004611f22565b610b0a565b6101b3600081565b61018e61028e366004611f22565b610b73565b61018e6102a1366004611ce2565b610bdc565b6101b36102b4366004611f84565b610c01565b60006001600160e01b03198216637965db0b60e01b14806102ea57506301ffc9a760e01b6001600160e01b03198316145b92915050565b60006102fb81610c1d565b610306600384610c2a565b50506001600160a01b0390911660009081526005602090815260408083208151808301909252938152428183019081528454600181810187559585529290932090516002909202019081559051910155565b60008281526020819052604090206001015461037381610c1d565b61037d8383610c46565b505050565b6001600160a01b03811633146103f75760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6104018282610cca565b5050565b600061041081610c1d565b6000600854118015610423575042600854105b6104845760405162461bcd60e51b815260206004820152602c60248201527f43616e206f6e6c7920776974686472617720333020646179732061667465722060448201526b185b9b9bdd5b98d95b595b9d60a21b60648201526084016103ee565b6001546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa1580156104cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104f19190611f9c565b60015490915061050b906001600160a01b03168483610d2f565b6040518181527f430648de173157e069201c943adb2d4e340e7cf5b27b1b09c9cb852f03d63b569060200160405180910390a1505050565b600061054e81610c1d565b600854156105925760405162461bcd60e51b8152602060048201526011602482015270105b1c9958591e48185b9b9bdd5b98d959607a1b60448201526064016103ee565b61059f4262278d00611fcb565b60088190556040519081527f9357a31bd5ed72ccd20facfb951dfddae395d18a81ce9ae3cba1bc10c8d9ed8d9060200160405180910390a150565b60005b8181101561037d5761065b8383838181106105fa576105fa611fe3565b6106109260206060909202019081019150611d0e565b84848481811061062257610622611fe3565b9050606002016020013585858581811061063e5761063e611fe3565b90506060020160400160208101906106569190611ff9565b610d81565b6001016105dd565b606061066f6003610fb6565b6001600160401b038111156106865761068661201a565b6040519080825280602002602001820160405280156106cc57816020015b6040805180820190915260008152606060208201528152602001906001900390816106a45790505b50905060005b6106dc6003610fb6565b8110156107b45760006106f0600383610fc0565b6040805180820182526001600160a01b03831680825260009081526005602090815283822080548551818402810184019096528086529596509294818601949392909184015b8282101561077c57838290600052602060002090600202016040518060400160405290816000820154815260200160018201548152505081526020019060010190610736565b5050505081525083838151811061079557610795611fe3565b60200260200101819052505080806107ac90612030565b9150506106d2565b5090565b60606000805b6107c86003610fb6565b81101561082d5760006107dc600383610fc0565b6001600160a01b03808716600090815260076020908152604080832093851683529290522090915061080d90610fb6565b6108179084611fcb565b925050808061082590612030565b9150506107be565b50806001600160401b038111156108465761084661201a565b6040519080825280602002602001820160405280156108a657816020015b6040805160c08101825260008082526020808301829052928201819052606082018190526080820181905260a082015282526000199092019101816108645790505b5091506000805b6108b76003610fb6565b811015610a9d5760006108cb600383610fc0565b905060005b6001600160a01b0380881660009081526007602090815260408083209386168352929052206108fe90610fb6565b811015610a88576001600160a01b03808816600090815260076020908152604080832093861683529290529081206109369083610fc0565b6001600160a01b0384811660009081526006602090815260408083208584528252808320815160a08101909252805494851682529495509193919290830190600160a01b900460ff16600381111561099057610990611e4f565b60038111156109a1576109a1611e4f565b815281546001600160401b03600160a81b90910481166020808401919091526001840154909116604080840191909152600290930154606090920191909152815160c0810183526001600160a01b03881681528082018690529083015192935091908201906003811115610a1757610a17611e4f565b815260200182604001516001600160401b0316815260200182606001516001600160401b031681526020018260800151815250888780610a5690612030565b985081518110610a6857610a68611fe3565b602002602001018190525050508080610a8090612030565b9150506108d0565b50508080610a9590612030565b9150506108ad565b505050919050565b6000610ab081610c1d565b600060088190556040517f6bcd1f6c4aebc81d81e3093e2f0e29e646cf00fcaaed7ab528d2a7c1f7309dad9190a150565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b60005b8181101561037d57610b61838383818110610b2a57610b2a611fe3565b610b409260206040909202019081019150611d0e565b848484818110610b5257610b52611fe3565b90506040020160200135610fcc565b80610b6b81612030565b915050610b0d565b60005b8181101561037d57610bca838383818110610b9357610b93611fe3565b610ba99260206040909202019081019150611d0e565b848484818110610bbb57610bbb611fe3565b90506040020160200135611249565b80610bd481612030565b915050610b76565b600082815260208190526040902060010154610bf781610c1d565b61037d8383610cca565b60006102ea610c136020840184611d0e565b8360200135611358565b610c2781336115a1565b50565b6000610c3f836001600160a01b038416611605565b9392505050565b610c508282610ae1565b610401576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055610c863390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b610cd48282610ae1565b15610401576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261037d908490611654565b610d8c600384611726565b610dd85760405162461bcd60e51b815260206004820152601c60248201527f4e465420636f6e7472616374206e6f742077686974656c69737465640000000060448201526064016103ee565b604051632142170760e11b8152336004820152306024820152604481018390526001600160a01b038416906342842e0e90606401600060405180830381600087803b158015610e2657600080fd5b505af1158015610e3a573d6000803e3d6000fd5b50503360009081526007602090815260408083206001600160a01b03891684529091529020610e6c9250905083611748565b506040518060a00160405280336001600160a01b03168152602001826003811115610e9957610e99611e4f565b81526001600160401b0342166020808301919091526000604080840182905260609093018190526001600160a01b0380881682526006835283822087835283529290208351815493166001600160a01b0319841681178255918401519092909183916001600160a81b03191617600160a01b836003811115610f1d57610f1d611e4f565b0217905550604082810151825467ffffffffffffffff60a81b1916600160a81b6001600160401b0392831602178355606084015160018401805467ffffffffffffffff1916919092161790556080909201516002909101555133907f8fd00d2abe7c284d5b1ad3b234d9eb25a6f5278296b9f767499e6022cec99fae90610fa990849087908790612049565b60405180910390a2505050565b60006102ea825490565b6000610c3f8383611754565b6001600160a01b03808316600090815260066020908152604080832085845290915290208054909116331461103b5760405162461bcd60e51b8152602060048201526015602482015274139bdd081bdddb995c881bd9881d1a1a5cc8139195605a1b60448201526064016103ee565b60018101546001600160401b03161561108d5760405162461bcd60e51b815260206004820152601460248201527313919508185b1c9958591e481d5b9cdd185ad95960621b60448201526064016103ee565b80544290600290600090600160a01b900460ff1660038111156110b2576110b2611e4f565b60038111156110c3576110c3611e4f565b815260208101919091526040016000205482546110f3916001600160401b0390811691600160a81b900416612071565b6001600160401b03161061113e5760405162461bcd60e51b815260206004820152601260248201527110d85b9b9bdd081d5b9cdd185ad9481e595d60721b60448201526064016103ee565b60018101805467ffffffffffffffff1916426001600160401b03161790553360009081526007602090815260408083206001600160a01b03871684529091529020611189908361177e565b506111948383611249565b8054604051632142170760e11b81523060048201526001600160a01b03918216602482015260448101849052908416906342842e0e90606401600060405180830381600087803b1580156111e757600080fd5b505af11580156111fb573d6000803e3d6000fd5b505082546040516001600160a01b03821693507fe408417720713dec6272606265b94df35720a6a425ca1168d4049c95983b59a39250610fa991600160a01b900460ff169087908790612049565b6001600160a01b0380831660009081526006602090815260408083208584529091529020805490911633146112b85760405162461bcd60e51b8152602060048201526015602482015274139bdd081bdddb995c881bd9881d1a1a5cc8139195605a1b60448201526064016103ee565b60006112c48484611358565b9050808260020160008282546112da9190611fcb565b909155505081546001546112fb916001600160a01b03918216911683610d2f565b815460405184916001600160a01b0387811692908216917f209021b438c87c94df9d32955e4b8e7b8dcaa053533b30b4f2b14c8a093ebdf59161134a91600160a01b900460ff1690879061209c565b60405180910390a450505050565b6001600160a01b038216600081815260066020908152604080832085845282528083209383526005825280832080548251818502810185019093528083529394938593849084015b828210156113e6578382906000526020600020906002020160405180604001604052908160008201548152602001600182015481525050815260200190600101906113a0565b505050509050600080600090505b82518110156115875760006114468560000160159054906101000a90046001600160401b03166001600160401b031685848151811061143557611435611fe3565b60200260200101516020015161178a565b905060006001855161145891906120b7565b831461148b578461146a846001611fcb565b8151811061147a5761147a611fe3565b60200260200101516020015161148d565b425b60018701549091506001600160401b0316156114be5760018601546114bb906001600160401b0316826117a1565b90505b60006114ca83836120b7565b87549091506283d60090600290600090600160a01b900460ff1660038111156114f5576114f5611e4f565b600381111561150657611506611e4f565b815260200190815260200160002060000160089054906101000a900461ffff1661ffff1687868151811061153c5761153c611fe3565b6020026020010151600001518361155391906120ce565b61155d91906120ce565b61156791906120ed565b6115719086611fcb565b94505050506115808160010190565b90506113f4565b50600283015461159790826120b7565b9695505050505050565b6115ab8282610ae1565b610401576115c3816001600160a01b031660146117b0565b6115ce8360206117b0565b6040516020016115df92919061213f565b60408051601f198184030181529082905262461bcd60e51b82526103ee916004016121b4565b600081815260018301602052604081205461164c575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556102ea565b5060006102ea565b60006116a9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661194b9092919063ffffffff16565b80519091501561037d57808060200190518101906116c791906121e7565b61037d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103ee565b6001600160a01b03811660009081526001830160205260408120541515610c3f565b6000610c3f8383611605565b600082600001828154811061176b5761176b611fe3565b9060005260206000200154905092915050565b6000610c3f8383611962565b60008183101561179a5781610c3f565b5090919050565b600081831061179a5781610c3f565b606060006117bf8360026120ce565b6117ca906002611fcb565b6001600160401b038111156117e1576117e161201a565b6040519080825280601f01601f19166020018201604052801561180b576020820181803683370190505b509050600360fc1b8160008151811061182657611826611fe3565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061185557611855611fe3565b60200101906001600160f81b031916908160001a90535060006118798460026120ce565b611884906001611fcb565b90505b60018111156118fc576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106118b8576118b8611fe3565b1a60f81b8282815181106118ce576118ce611fe3565b60200101906001600160f81b031916908160001a90535060049490941c936118f581612209565b9050611887565b508315610c3f5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016103ee565b606061195a8484600085611a55565b949350505050565b60008181526001830160205260408120548015611a4b5760006119866001836120b7565b855490915060009061199a906001906120b7565b90508181146119ff5760008660000182815481106119ba576119ba611fe3565b90600052602060002001549050808760000184815481106119dd576119dd611fe3565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080611a1057611a10612220565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506102ea565b60009150506102ea565b606082471015611ab65760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016103ee565b6001600160a01b0385163b611b0d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103ee565b600080866001600160a01b03168587604051611b299190612236565b60006040518083038185875af1925050503d8060008114611b66576040519150601f19603f3d011682016040523d82523d6000602084013e611b6b565b606091505b5091509150611b7b828286611b86565b979650505050505050565b60608315611b95575081610c3f565b825115611ba55782518084602001fd5b8160405162461bcd60e51b81526004016103ee91906121b4565b600060208284031215611bd157600080fd5b81356001600160e01b031981168114610c3f57600080fd5b80356001600160a01b0381168114611c0057600080fd5b919050565b600080600080600060808688031215611c1d57600080fd5b611c2686611be9565b9450611c3460208701611be9565b93506040860135925060608601356001600160401b0380821115611c5757600080fd5b818801915088601f830112611c6b57600080fd5b813581811115611c7a57600080fd5b896020828501011115611c8c57600080fd5b9699959850939650602001949392505050565b60008060408385031215611cb257600080fd5b611cbb83611be9565b946020939093013593505050565b600060208284031215611cdb57600080fd5b5035919050565b60008060408385031215611cf557600080fd5b82359150611d0560208401611be9565b90509250929050565b600060208284031215611d2057600080fd5b610c3f82611be9565b60008060208385031215611d3c57600080fd5b82356001600160401b0380821115611d5357600080fd5b818501915085601f830112611d6757600080fd5b813581811115611d7657600080fd5b866020606083028501011115611d8b57600080fd5b60209290920196919550909350505050565b60006020808301818452808551808352604092508286019150828160051b8701018488016000805b84811015611e4057898403603f19018652825180516001600160a01b03168552880151888501889052805188860181905290890190839060608701905b80831015611e2b578351805183528c01518c830152928b019260019290920191908a0190611e02565b50978a01979550505091870191600101611dc5565b50919998505050505050505050565b634e487b7160e01b600052602160045260246000fd5b60048110611e8357634e487b7160e01b600052602160045260246000fd5b9052565b602080825282518282018190526000919060409081850190868401855b82811015611f1557815180516001600160a01b03168552868101518786015285810151611ed387870182611e65565b506060818101516001600160401b03908116918701919091526080808301519091169086015260a0908101519085015260c09093019290850190600101611ea4565b5091979650505050505050565b60008060208385031215611f3557600080fd5b82356001600160401b0380821115611f4c57600080fd5b818501915085601f830112611f6057600080fd5b813581811115611f6f57600080fd5b8660208260061b8501011115611d8b57600080fd5b600060408284031215611f9657600080fd5b50919050565b600060208284031215611fae57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60008219821115611fde57611fde611fb5565b500190565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561200b57600080fd5b813560048110610c3f57600080fd5b634e487b7160e01b600052604160045260246000fd5b60006001820161204257612042611fb5565b5060010190565b606081016120578286611e65565b6001600160a01b0393909316602082015260400152919050565b60006001600160401b0380831681851680830382111561209357612093611fb5565b01949350505050565b604081016120aa8285611e65565b8260208301529392505050565b6000828210156120c9576120c9611fb5565b500390565b60008160001904831182151516156120e8576120e8611fb5565b500290565b60008261210a57634e487b7160e01b600052601260045260246000fd5b500490565b60005b8381101561212a578181015183820152602001612112565b83811115612139576000848401525b50505050565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161217781601785016020880161210f565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516121a881602884016020880161210f565b01602801949350505050565b60208152600082518060208401526121d381604085016020870161210f565b601f01601f19169190910160400192915050565b6000602082840312156121f957600080fd5b81518015158114610c3f57600080fd5b60008161221857612218611fb5565b506000190190565b634e487b7160e01b600052603160045260246000fd5b6000825161224881846020870161210f565b919091019291505056fea2646970667358221220f2b2ee0cfcde240aa2847ec590c328062d3fe47b4ddb8ca82ecea5bed06cf2d964736f6c634300080e0033000000000000000000000000fcbcebaada7f2563b40b7ad9695e18b354b2b1ae000000000000000000000000ebb832a3334295d530ae13e598aeee22083caa3f

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101165760003560e01c80637e47daa1116100a257806394d8d7e91161007157806394d8d7e914610265578063a217fddf14610278578063af7ec6cb14610280578063d547741f14610293578063e7c6c2e5146102a657600080fd5b80637e47daa114610215578063842e29811461022a57806384b768241461024a57806391d148541461025257600080fd5b80632f2ff15d116100e95780632f2ff15d146101c157806336568abe146101d457806351cff8d9146101e75780636ee787d8146101fa57806374b0f4e51461020257600080fd5b806301ffc9a71461011b578063150b7a021461014357806316f2f70f1461017b578063248a9ca314610190575b600080fd5b61012e610129366004611bbf565b6102b9565b60405190151581526020015b60405180910390f35b610162610151366004611c05565b630a85bd0160e11b95945050505050565b6040516001600160e01b0319909116815260200161013a565b61018e610189366004611c9f565b6102f0565b005b6101b361019e366004611cc9565b60009081526020819052604090206001015490565b60405190815260200161013a565b61018e6101cf366004611ce2565b610358565b61018e6101e2366004611ce2565b610382565b61018e6101f5366004611d0e565b610405565b61018e610543565b61018e610210366004611d29565b6105da565b61021d610663565b60405161013a9190611d9d565b61023d610238366004611d0e565b6107b8565b60405161013a9190611e87565b61018e610aa5565b61012e610260366004611ce2565b610ae1565b61018e610273366004611f22565b610b0a565b6101b3600081565b61018e61028e366004611f22565b610b73565b61018e6102a1366004611ce2565b610bdc565b6101b36102b4366004611f84565b610c01565b60006001600160e01b03198216637965db0b60e01b14806102ea57506301ffc9a760e01b6001600160e01b03198316145b92915050565b60006102fb81610c1d565b610306600384610c2a565b50506001600160a01b0390911660009081526005602090815260408083208151808301909252938152428183019081528454600181810187559585529290932090516002909202019081559051910155565b60008281526020819052604090206001015461037381610c1d565b61037d8383610c46565b505050565b6001600160a01b03811633146103f75760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6104018282610cca565b5050565b600061041081610c1d565b6000600854118015610423575042600854105b6104845760405162461bcd60e51b815260206004820152602c60248201527f43616e206f6e6c7920776974686472617720333020646179732061667465722060448201526b185b9b9bdd5b98d95b595b9d60a21b60648201526084016103ee565b6001546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa1580156104cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104f19190611f9c565b60015490915061050b906001600160a01b03168483610d2f565b6040518181527f430648de173157e069201c943adb2d4e340e7cf5b27b1b09c9cb852f03d63b569060200160405180910390a1505050565b600061054e81610c1d565b600854156105925760405162461bcd60e51b8152602060048201526011602482015270105b1c9958591e48185b9b9bdd5b98d959607a1b60448201526064016103ee565b61059f4262278d00611fcb565b60088190556040519081527f9357a31bd5ed72ccd20facfb951dfddae395d18a81ce9ae3cba1bc10c8d9ed8d9060200160405180910390a150565b60005b8181101561037d5761065b8383838181106105fa576105fa611fe3565b6106109260206060909202019081019150611d0e565b84848481811061062257610622611fe3565b9050606002016020013585858581811061063e5761063e611fe3565b90506060020160400160208101906106569190611ff9565b610d81565b6001016105dd565b606061066f6003610fb6565b6001600160401b038111156106865761068661201a565b6040519080825280602002602001820160405280156106cc57816020015b6040805180820190915260008152606060208201528152602001906001900390816106a45790505b50905060005b6106dc6003610fb6565b8110156107b45760006106f0600383610fc0565b6040805180820182526001600160a01b03831680825260009081526005602090815283822080548551818402810184019096528086529596509294818601949392909184015b8282101561077c57838290600052602060002090600202016040518060400160405290816000820154815260200160018201548152505081526020019060010190610736565b5050505081525083838151811061079557610795611fe3565b60200260200101819052505080806107ac90612030565b9150506106d2565b5090565b60606000805b6107c86003610fb6565b81101561082d5760006107dc600383610fc0565b6001600160a01b03808716600090815260076020908152604080832093851683529290522090915061080d90610fb6565b6108179084611fcb565b925050808061082590612030565b9150506107be565b50806001600160401b038111156108465761084661201a565b6040519080825280602002602001820160405280156108a657816020015b6040805160c08101825260008082526020808301829052928201819052606082018190526080820181905260a082015282526000199092019101816108645790505b5091506000805b6108b76003610fb6565b811015610a9d5760006108cb600383610fc0565b905060005b6001600160a01b0380881660009081526007602090815260408083209386168352929052206108fe90610fb6565b811015610a88576001600160a01b03808816600090815260076020908152604080832093861683529290529081206109369083610fc0565b6001600160a01b0384811660009081526006602090815260408083208584528252808320815160a08101909252805494851682529495509193919290830190600160a01b900460ff16600381111561099057610990611e4f565b60038111156109a1576109a1611e4f565b815281546001600160401b03600160a81b90910481166020808401919091526001840154909116604080840191909152600290930154606090920191909152815160c0810183526001600160a01b03881681528082018690529083015192935091908201906003811115610a1757610a17611e4f565b815260200182604001516001600160401b0316815260200182606001516001600160401b031681526020018260800151815250888780610a5690612030565b985081518110610a6857610a68611fe3565b602002602001018190525050508080610a8090612030565b9150506108d0565b50508080610a9590612030565b9150506108ad565b505050919050565b6000610ab081610c1d565b600060088190556040517f6bcd1f6c4aebc81d81e3093e2f0e29e646cf00fcaaed7ab528d2a7c1f7309dad9190a150565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b60005b8181101561037d57610b61838383818110610b2a57610b2a611fe3565b610b409260206040909202019081019150611d0e565b848484818110610b5257610b52611fe3565b90506040020160200135610fcc565b80610b6b81612030565b915050610b0d565b60005b8181101561037d57610bca838383818110610b9357610b93611fe3565b610ba99260206040909202019081019150611d0e565b848484818110610bbb57610bbb611fe3565b90506040020160200135611249565b80610bd481612030565b915050610b76565b600082815260208190526040902060010154610bf781610c1d565b61037d8383610cca565b60006102ea610c136020840184611d0e565b8360200135611358565b610c2781336115a1565b50565b6000610c3f836001600160a01b038416611605565b9392505050565b610c508282610ae1565b610401576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055610c863390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b610cd48282610ae1565b15610401576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261037d908490611654565b610d8c600384611726565b610dd85760405162461bcd60e51b815260206004820152601c60248201527f4e465420636f6e7472616374206e6f742077686974656c69737465640000000060448201526064016103ee565b604051632142170760e11b8152336004820152306024820152604481018390526001600160a01b038416906342842e0e90606401600060405180830381600087803b158015610e2657600080fd5b505af1158015610e3a573d6000803e3d6000fd5b50503360009081526007602090815260408083206001600160a01b03891684529091529020610e6c9250905083611748565b506040518060a00160405280336001600160a01b03168152602001826003811115610e9957610e99611e4f565b81526001600160401b0342166020808301919091526000604080840182905260609093018190526001600160a01b0380881682526006835283822087835283529290208351815493166001600160a01b0319841681178255918401519092909183916001600160a81b03191617600160a01b836003811115610f1d57610f1d611e4f565b0217905550604082810151825467ffffffffffffffff60a81b1916600160a81b6001600160401b0392831602178355606084015160018401805467ffffffffffffffff1916919092161790556080909201516002909101555133907f8fd00d2abe7c284d5b1ad3b234d9eb25a6f5278296b9f767499e6022cec99fae90610fa990849087908790612049565b60405180910390a2505050565b60006102ea825490565b6000610c3f8383611754565b6001600160a01b03808316600090815260066020908152604080832085845290915290208054909116331461103b5760405162461bcd60e51b8152602060048201526015602482015274139bdd081bdddb995c881bd9881d1a1a5cc8139195605a1b60448201526064016103ee565b60018101546001600160401b03161561108d5760405162461bcd60e51b815260206004820152601460248201527313919508185b1c9958591e481d5b9cdd185ad95960621b60448201526064016103ee565b80544290600290600090600160a01b900460ff1660038111156110b2576110b2611e4f565b60038111156110c3576110c3611e4f565b815260208101919091526040016000205482546110f3916001600160401b0390811691600160a81b900416612071565b6001600160401b03161061113e5760405162461bcd60e51b815260206004820152601260248201527110d85b9b9bdd081d5b9cdd185ad9481e595d60721b60448201526064016103ee565b60018101805467ffffffffffffffff1916426001600160401b03161790553360009081526007602090815260408083206001600160a01b03871684529091529020611189908361177e565b506111948383611249565b8054604051632142170760e11b81523060048201526001600160a01b03918216602482015260448101849052908416906342842e0e90606401600060405180830381600087803b1580156111e757600080fd5b505af11580156111fb573d6000803e3d6000fd5b505082546040516001600160a01b03821693507fe408417720713dec6272606265b94df35720a6a425ca1168d4049c95983b59a39250610fa991600160a01b900460ff169087908790612049565b6001600160a01b0380831660009081526006602090815260408083208584529091529020805490911633146112b85760405162461bcd60e51b8152602060048201526015602482015274139bdd081bdddb995c881bd9881d1a1a5cc8139195605a1b60448201526064016103ee565b60006112c48484611358565b9050808260020160008282546112da9190611fcb565b909155505081546001546112fb916001600160a01b03918216911683610d2f565b815460405184916001600160a01b0387811692908216917f209021b438c87c94df9d32955e4b8e7b8dcaa053533b30b4f2b14c8a093ebdf59161134a91600160a01b900460ff1690879061209c565b60405180910390a450505050565b6001600160a01b038216600081815260066020908152604080832085845282528083209383526005825280832080548251818502810185019093528083529394938593849084015b828210156113e6578382906000526020600020906002020160405180604001604052908160008201548152602001600182015481525050815260200190600101906113a0565b505050509050600080600090505b82518110156115875760006114468560000160159054906101000a90046001600160401b03166001600160401b031685848151811061143557611435611fe3565b60200260200101516020015161178a565b905060006001855161145891906120b7565b831461148b578461146a846001611fcb565b8151811061147a5761147a611fe3565b60200260200101516020015161148d565b425b60018701549091506001600160401b0316156114be5760018601546114bb906001600160401b0316826117a1565b90505b60006114ca83836120b7565b87549091506283d60090600290600090600160a01b900460ff1660038111156114f5576114f5611e4f565b600381111561150657611506611e4f565b815260200190815260200160002060000160089054906101000a900461ffff1661ffff1687868151811061153c5761153c611fe3565b6020026020010151600001518361155391906120ce565b61155d91906120ce565b61156791906120ed565b6115719086611fcb565b94505050506115808160010190565b90506113f4565b50600283015461159790826120b7565b9695505050505050565b6115ab8282610ae1565b610401576115c3816001600160a01b031660146117b0565b6115ce8360206117b0565b6040516020016115df92919061213f565b60408051601f198184030181529082905262461bcd60e51b82526103ee916004016121b4565b600081815260018301602052604081205461164c575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556102ea565b5060006102ea565b60006116a9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661194b9092919063ffffffff16565b80519091501561037d57808060200190518101906116c791906121e7565b61037d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103ee565b6001600160a01b03811660009081526001830160205260408120541515610c3f565b6000610c3f8383611605565b600082600001828154811061176b5761176b611fe3565b9060005260206000200154905092915050565b6000610c3f8383611962565b60008183101561179a5781610c3f565b5090919050565b600081831061179a5781610c3f565b606060006117bf8360026120ce565b6117ca906002611fcb565b6001600160401b038111156117e1576117e161201a565b6040519080825280601f01601f19166020018201604052801561180b576020820181803683370190505b509050600360fc1b8160008151811061182657611826611fe3565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061185557611855611fe3565b60200101906001600160f81b031916908160001a90535060006118798460026120ce565b611884906001611fcb565b90505b60018111156118fc576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106118b8576118b8611fe3565b1a60f81b8282815181106118ce576118ce611fe3565b60200101906001600160f81b031916908160001a90535060049490941c936118f581612209565b9050611887565b508315610c3f5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016103ee565b606061195a8484600085611a55565b949350505050565b60008181526001830160205260408120548015611a4b5760006119866001836120b7565b855490915060009061199a906001906120b7565b90508181146119ff5760008660000182815481106119ba576119ba611fe3565b90600052602060002001549050808760000184815481106119dd576119dd611fe3565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080611a1057611a10612220565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506102ea565b60009150506102ea565b606082471015611ab65760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016103ee565b6001600160a01b0385163b611b0d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103ee565b600080866001600160a01b03168587604051611b299190612236565b60006040518083038185875af1925050503d8060008114611b66576040519150601f19603f3d011682016040523d82523d6000602084013e611b6b565b606091505b5091509150611b7b828286611b86565b979650505050505050565b60608315611b95575081610c3f565b825115611ba55782518084602001fd5b8160405162461bcd60e51b81526004016103ee91906121b4565b600060208284031215611bd157600080fd5b81356001600160e01b031981168114610c3f57600080fd5b80356001600160a01b0381168114611c0057600080fd5b919050565b600080600080600060808688031215611c1d57600080fd5b611c2686611be9565b9450611c3460208701611be9565b93506040860135925060608601356001600160401b0380821115611c5757600080fd5b818801915088601f830112611c6b57600080fd5b813581811115611c7a57600080fd5b896020828501011115611c8c57600080fd5b9699959850939650602001949392505050565b60008060408385031215611cb257600080fd5b611cbb83611be9565b946020939093013593505050565b600060208284031215611cdb57600080fd5b5035919050565b60008060408385031215611cf557600080fd5b82359150611d0560208401611be9565b90509250929050565b600060208284031215611d2057600080fd5b610c3f82611be9565b60008060208385031215611d3c57600080fd5b82356001600160401b0380821115611d5357600080fd5b818501915085601f830112611d6757600080fd5b813581811115611d7657600080fd5b866020606083028501011115611d8b57600080fd5b60209290920196919550909350505050565b60006020808301818452808551808352604092508286019150828160051b8701018488016000805b84811015611e4057898403603f19018652825180516001600160a01b03168552880151888501889052805188860181905290890190839060608701905b80831015611e2b578351805183528c01518c830152928b019260019290920191908a0190611e02565b50978a01979550505091870191600101611dc5565b50919998505050505050505050565b634e487b7160e01b600052602160045260246000fd5b60048110611e8357634e487b7160e01b600052602160045260246000fd5b9052565b602080825282518282018190526000919060409081850190868401855b82811015611f1557815180516001600160a01b03168552868101518786015285810151611ed387870182611e65565b506060818101516001600160401b03908116918701919091526080808301519091169086015260a0908101519085015260c09093019290850190600101611ea4565b5091979650505050505050565b60008060208385031215611f3557600080fd5b82356001600160401b0380821115611f4c57600080fd5b818501915085601f830112611f6057600080fd5b813581811115611f6f57600080fd5b8660208260061b8501011115611d8b57600080fd5b600060408284031215611f9657600080fd5b50919050565b600060208284031215611fae57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60008219821115611fde57611fde611fb5565b500190565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561200b57600080fd5b813560048110610c3f57600080fd5b634e487b7160e01b600052604160045260246000fd5b60006001820161204257612042611fb5565b5060010190565b606081016120578286611e65565b6001600160a01b0393909316602082015260400152919050565b60006001600160401b0380831681851680830382111561209357612093611fb5565b01949350505050565b604081016120aa8285611e65565b8260208301529392505050565b6000828210156120c9576120c9611fb5565b500390565b60008160001904831182151516156120e8576120e8611fb5565b500290565b60008261210a57634e487b7160e01b600052601260045260246000fd5b500490565b60005b8381101561212a578181015183820152602001612112565b83811115612139576000848401525b50505050565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161217781601785016020880161210f565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516121a881602884016020880161210f565b01602801949350505050565b60208152600082518060208401526121d381604085016020870161210f565b601f01601f19169190910160400192915050565b6000602082840312156121f957600080fd5b81518015158114610c3f57600080fd5b60008161221857612218611fb5565b506000190190565b634e487b7160e01b600052603160045260246000fd5b6000825161224881846020870161210f565b919091019291505056fea2646970667358221220f2b2ee0cfcde240aa2847ec590c328062d3fe47b4ddb8ca82ecea5bed06cf2d964736f6c634300080e0033

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

000000000000000000000000fcbcebaada7f2563b40b7ad9695e18b354b2b1ae000000000000000000000000ebb832a3334295d530ae13e598aeee22083caa3f

-----Decoded View---------------
Arg [0] : _rewardToken (address): 0xfCbcEBaada7f2563b40b7ad9695e18B354B2b1Ae
Arg [1] : _admin (address): 0xebb832a3334295d530AE13E598AeEE22083cAa3F

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000fcbcebaada7f2563b40b7ad9695e18b354b2b1ae
Arg [1] : 000000000000000000000000ebb832a3334295d530ae13e598aeee22083caa3f


Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]

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