ETH Price: $3,504.90 (-0.13%)
Gas: 2 Gwei

Contract

0xf94Dd2e9aF8B91BDBcdc4155f2C45DB95CAB3113
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0x60806040171079722023-04-23 8:58:23454 days ago1682240303IN
 Create: StakingUpgradableV2
0 ETH0.0559848837.82751988

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
StakingUpgradableV2

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 12 : StakingUpgradableV2.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

import "./StakingUpgradable.sol";
import "@chocolate-factory/contracts/staking/TrackerUpgradeable.sol";
import "@chocolate-factory/contracts/staking/ReceiverUpgradeable.sol";

contract StakingUpgradableV2 is
    StakingUpgradable,
    TrackerUpgradeable,
    ReceiverUpgradeable
{
    uint256 public stakingFrom;
    mapping(address => uint256) public stakedFrom;

    event NFTStaked(address account, uint256[] ids);
    event NFTUnstaked(address acount, uint256[] ids);

    function initializerV2(IERC721Upgradeable _nft) public reinitializer(2) {
        __Tracker_init();
        __Receiver_init(_nft);
        stakingFrom = 4;
    }

     /**
     * 
     * @param cycle_ cycle of interest
     * @param recipient recipient
     * 
     * Return 108 if they had staked the nft before NFT staking.
     * Return 112 if they had staked the nft after NFT Staking was live, but also if they have staked before
     * Return 104 if no NFT was staked, or if there was no nfts staked in cycles before
     *  
     * If stakedFrom is before the cycle, it must mean they had the NFT staked before and therefore
     * it should return bonus interest. Otherwise, if they are claiming for when the nft was staked
     * return bonus value
     */
    function interestMultiplier(uint256 cycle_, address recipient) public view returns (uint256) {
        if(cycle_ < stakingFrom) return 108;        
        uint256 _stakedFrom = stakedFrom[recipient];
        bool hadNFTStakedBefore = _stakedFrom > 0 && cycle_ >= _stakedFrom;
        return hadNFTStakedBefore ? 112 : 104;
    }

    function stake(uint256 cycle_, uint256[] memory ids_) external payable nonReentrant whenNotPaused {
        _validateStake(cycle_);
        require(msg.value >= 0.1 ether, "Invalid ETH amount");
        balances[msg.sender][cycle_] += msg.value;
        uint256 total = ids_.length;
        if(total > 0) {            
            for(uint256 i; i < total; i++) {
                uint256 id = ids_[i];
                require(nft.ownerOf(id) == msg.sender, "Not Owner");
                Token memory token = token(id);
                token.owner = msg.sender;
                _setToken(token, id);
                _receive(id, msg.sender);
            }                        
            _increaseBalance(msg.sender, total);
            if(stakedFrom[msg.sender] == 0 && balanceOf(msg.sender) > 0) {
                stakedFrom[msg.sender] = cycle_;
            }
            emit NFTStaked(msg.sender, ids_);
        }

        emit Staked(msg.sender, cycle_, msg.value);
    }

    function claim(uint256 cycle_, uint256[] memory ids_) external nonReentrant whenNotPaused {
        _validateClaim(cycle_);
        uint256 balanceToClaim = (balances[msg.sender][cycle_] *
            interestMultiplier(cycle_, msg.sender)) / 100;

        balances[msg.sender][cycle_] = 0;

        if(ids_.length > 0) {
            uint256 total = ids_.length;
            for(uint256 i; i < total; i++) {
                uint256 id = ids_[i];
                require(ownerOf(id) == msg.sender, "Not Owner");
                Token memory token = token(id);
                token.owner = address(0x0);
                _setToken(token, id);
                _return(id, msg.sender);
            }            
            _decreaseBalance(msg.sender, total);
            if(balanceOf(msg.sender) == 0) {
                stakedFrom[msg.sender] = 0;
            }
            emit NFTUnstaked(msg.sender, ids_);
        }

        AddressUpgradeable.sendValue(payable(msg.sender), balanceToClaim);
        emit Claimed(msg.sender, cycle_, balanceToClaim);
    }

    function reStake(
        uint256[] calldata cyclesToClaim_,
        uint256 cycleToStake_
    ) external nonReentrant whenNotPaused {
        uint256 totalBalance = 0;
        for (uint256 i = 0; i < cyclesToClaim_.length; i++) {
            uint256 cycleToClaim = cyclesToClaim_[i];
            _validateClaim(cycleToClaim);
            uint256 balanceToClaim = (balances[msg.sender][cycleToClaim] *
                interestMultiplier(cycleToClaim, msg.sender)) / 100;
            totalBalance += balanceToClaim;
            balances[msg.sender][cycleToClaim] = 0;     
            emit Claimed(msg.sender, cycleToClaim, balanceToClaim);
        }
        _validateStake(cycleToStake_);
        balances[msg.sender][cycleToStake_] += totalBalance;
        emit Staked(msg.sender, cycleToStake_, totalBalance);
    }

    function setNFT(IERC721Upgradeable _nft) external onlyAdmin {
        nft = _nft;
    }

    function setStakingFrom(uint256 _stakingFrom) external onlyAdmin {
        stakingFrom = _stakingFrom;
    }
}

File 2 of 12 : ReceiverUpgradeable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol";

contract ReceiverUpgradeable is Initializable, IERC721ReceiverUpgradeable {
    IERC721Upgradeable public nft;

    function __Receiver_init(IERC721Upgradeable nft_) internal onlyInitializing {
        nft = nft_;
    }

    function _receive(uint256 id_, address from_) internal {
        nft.safeTransferFrom(from_, address(this), id_);
    }

    function _return(uint256 id_, address to_) internal {
        nft.safeTransferFrom(address(this), to_, id_);
    }

    function onERC721Received(
        address,
        address,
        uint256,
        bytes calldata 
    ) external pure override(IERC721ReceiverUpgradeable) returns (bytes4) {
        return IERC721ReceiverUpgradeable.onERC721Received.selector;
    }
}

File 3 of 12 : TrackerUpgradeable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

contract TrackerUpgradeable is Initializable {
    struct Token {
        address owner;
        uint256 timestamp;
        uint256 accrued;
    }

    function __Tracker_init() internal onlyInitializing {}

    mapping(uint256 => Token) private _tokens;
    mapping(address => uint256) private _balances;

    function token(uint256 id_) public view returns (Token memory) {
        return _tokens[id_];
    }

    function _setToken(Token memory token_, uint256 id_) internal {
        _tokens[id_] = token_;
    }

    function _increaseBalance(address owner_, uint256 amount_) internal {
        _balances[owner_] += amount_;
    }

    function _decreaseBalance(address owner_, uint256 amount_) internal {
        _balances[owner_] -= amount_;
    }

    function balanceOf(address owner_) public view returns (uint256) {
        return _balances[owner_];
    }

    function ownerOf(uint256 tokenId) public view returns (address) {
        return token(tokenId).owner;
    }

    /**
        @dev for offchain purposes
     */
    function tokensOfOwner(address owner) external view virtual returns (uint256[] memory) {
        unchecked {
            uint256 tokenIdsIdx;
            uint256 tokenIdsLength = balanceOf(owner);
            uint256[] memory tokenIds = new uint256[](tokenIdsLength);
            for (uint256 i = 0; tokenIdsIdx != tokenIdsLength; ++i) {
                Token memory data = _tokens[i];
                if (data.owner == owner) {
                    tokenIds[tokenIdsIdx++] = i;
                }
            }
            return tokenIds;
        }
    }
}

File 4 of 12 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
     * constructor.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: setting the version to 255 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized < type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint8) {
        return _initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _initializing;
    }
}

File 5 of 12 : PausableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    function __Pausable_init() internal onlyInitializing {
        __Pausable_init_unchained();
    }

    function __Pausable_init_unchained() internal onlyInitializing {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 6 of 12 : ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

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

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

    uint256 private _status;

    function __ReentrancyGuard_init() internal onlyInitializing {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        _status = _NOT_ENTERED;
    }

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

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

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

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 7 of 12 : IERC721ReceiverUpgradeable.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 IERC721ReceiverUpgradeable {
    /**
     * @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);
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

File 9 of 12 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

File 10 of 12 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @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 ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 11 of 12 : IERC165Upgradeable.sol
// 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 IERC165Upgradeable {
    /**
     * @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);
}

File 12 of 12 : StakingUpgradable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@chocolate-factory/contracts/staking/TrackerUpgradeable.sol";
import "@chocolate-factory/contracts/staking/ReceiverUpgradeable.sol";

contract StakingUpgradable is
    Initializable,
    PausableUpgradeable,
    ReentrancyGuardUpgradeable
{
    uint256 private constant _startTime = 1678806000;
    uint256 private constant _cycleDuration = 45 days;
    uint256 private constant _cyclesInterval = 10 days;
    uint256 private constant _cycleRegistryDuration = 3 days;
    uint256 private constant _interestMultiplier = 108;

    mapping(address => bool) internal _admins;
    mapping(address => mapping(uint256 => uint256)) public balances;

    event Staked(address account, uint256 cycle, uint256 amount);
    event Claimed(address account, uint256 cycle, uint256 amount);

    function initialize() public initializer {
        _admins[msg.sender] = true;
    }

    function withdraw(uint256 balance) external onlyAdmin {
        AddressUpgradeable.sendValue(payable(msg.sender), balance);
    }

    function isAdmin(address account_) public view returns (bool) {
        return _admins[account_];
    }

    function setAdminPermissions(
        address account_,
        bool enable_
    ) external onlyAdmin {
        _admins[account_] = enable_;
    }

    function pause() external onlyAdmin {
        _pause();
    }

    function unpause() external onlyAdmin {
        _unpause();
    }

    function _validateStake(uint256 cycle_) internal view {
        (uint256 registryStart, uint256 registryEnd) = _getCycleRegistryData(
            cycle_
        );
        if (block.timestamp < registryStart || block.timestamp > registryEnd) {
            revert("Stake not enabled");
        }
    }

    function _validateClaim(uint256 cycle_) internal view {
        (, uint256 registryEnd) = _getCycleRegistryData(cycle_);
        uint256 cycleEnd = registryEnd + _cycleDuration;

        if (block.timestamp <= cycleEnd) {
            revert("Claim not enabled");
        }
    }

    function _getCycleRegistryData(
        uint256 cycle_
    ) private pure returns (uint256, uint256) {
        uint256 registryStart = _startTime + cycle_ * _cyclesInterval;
        uint256 registryEnd = registryStart + _cycleRegistryDuration;
        return (registryStart, registryEnd);
    }

    modifier onlyAdmin() {
        if (!isAdmin(msg.sender)) {
            revert("Not and admin");
        }
        _;
    }

    receive() external payable {}
}

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

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"cycle","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Claimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"NFTStaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"acount","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"NFTUnstaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"cycle","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"internalType":"address","name":"owner_","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"balances","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"cycle_","type":"uint256"},{"internalType":"uint256[]","name":"ids_","type":"uint256[]"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC721Upgradeable","name":"_nft","type":"address"}],"name":"initializerV2","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"cycle_","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"interestMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account_","type":"address"}],"name":"isAdmin","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nft","outputs":[{"internalType":"contract IERC721Upgradeable","name":"","type":"address"}],"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":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"cyclesToClaim_","type":"uint256[]"},{"internalType":"uint256","name":"cycleToStake_","type":"uint256"}],"name":"reStake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account_","type":"address"},{"internalType":"bool","name":"enable_","type":"bool"}],"name":"setAdminPermissions","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC721Upgradeable","name":"_nft","type":"address"}],"name":"setNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_stakingFrom","type":"uint256"}],"name":"setStakingFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"cycle_","type":"uint256"},{"internalType":"uint256[]","name":"ids_","type":"uint256[]"}],"name":"stake","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"stakedFrom","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakingFrom","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id_","type":"uint256"}],"name":"token","outputs":[{"components":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"uint256","name":"accrued","type":"uint256"}],"internalType":"struct TrackerUpgradeable.Token","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"tokensOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

608060405234801561001057600080fd5b506119ce806100206000396000f3fe6080604052600436106101445760003560e01c806370a08231116100b6578063aedb71c11161006f578063aedb71c1146103ea578063b1b6665214610417578063cbf1304d14610437578063f3c479d81461046f578063f4cd24f214610485578063f56e9c66146104a557600080fd5b806370a082311461030f57806377479a69146103535780638129fc1c146103735780638456cb59146103885780638462151c1461039d5780639a562695146103ca57600080fd5b80632e1a7d4d116101085780632e1a7d4d1461024a5780633f4ba83a1461026a57806347ccca021461027f5780635c975abb146102b75780635de78afd146102cf5780636352211e146102ef57600080fd5b8063044215c614610150578063150b7a02146101a057806316f60557146101e5578063240ff27f146101fa57806324d7806c1461021a57600080fd5b3661014b57005b600080fd5b34801561015c57600080fd5b5061017061016b3660046114a1565b6104c5565b6040805182516001600160a01b031681526020808401519082015291810151908201526060015b60405180910390f35b3480156101ac57600080fd5b506101cc6101bb3660046114cf565b630a85bd0160e11b95945050505050565b6040516001600160e01b03199091168152602001610197565b6101f86101f3366004611584565b610534565b005b34801561020657600080fd5b506101f861021536600461164e565b6107be565b34801561022657600080fd5b5061023a61023536600461168c565b61080e565b6040519015158152602001610197565b34801561025657600080fd5b506101f86102653660046114a1565b61082c565b34801561027657600080fd5b506101f861085e565b34801561028b57600080fd5b50609b5461029f906001600160a01b031681565b6040516001600160a01b039091168152602001610197565b3480156102c357600080fd5b5060335460ff1661023a565b3480156102db57600080fd5b506101f86102ea3660046114a1565b61088d565b3480156102fb57600080fd5b5061029f61030a3660046114a1565b6108b7565b34801561031b57600080fd5b5061034561032a36600461168c565b6001600160a01b03166000908152609a602052604090205490565b604051908152602001610197565b34801561035f57600080fd5b5061034561036e3660046116b0565b6108c9565b34801561037f57600080fd5b506101f8610925565b34801561039457600080fd5b506101f8610a00565b3480156103a957600080fd5b506103bd6103b836600461168c565b610a2d565b6040516101979190611710565b3480156103d657600080fd5b506101f86103e5366004611723565b610b27565b3480156103f657600080fd5b5061034561040536600461168c565b609d6020526000908152604090205481565b34801561042357600080fd5b506101f8610432366004611584565b610ca7565b34801561044357600080fd5b5061034561045236600461179e565b609860209081526000928352604080842090915290825290205481565b34801561047b57600080fd5b50610345609c5481565b34801561049157600080fd5b506101f86104a036600461168c565b610e87565b3480156104b157600080fd5b506101f86104c036600461168c565b610f34565b6104f2604051806060016040528060006001600160a01b0316815260200160008152602001600081525090565b50600090815260996020908152604091829020825160608101845281546001600160a01b03168152600182015492810192909252600201549181019190915290565b61053c610f7b565b610544610fd4565b61054d8261101a565b67016345785d8a000034101561059f5760405162461bcd60e51b8152602060048201526012602482015271125b9d985b1a590811551208185b5bdd5b9d60721b60448201526064015b60405180910390fd5b336000908152609860209081526040808320858452909152812080543492906105c99084906117e0565b9091555050805180156107745760005b818110156106ed5760008382815181106105f5576105f56117f3565b6020908102919091010151609b546040516331a9108f60e11b81526004810183905291925033916001600160a01b0390911690636352211e90602401602060405180830381865afa15801561064e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106729190611809565b6001600160a01b0316146106b45760405162461bcd60e51b81526020600482015260096024820152682737ba1027bbb732b960b91b6044820152606401610596565b60006106bf826104c5565b33815290506106ce8183611078565b6106d882336110ba565b505080806106e590611826565b9150506105d9565b506106f8338261112b565b336000908152609d60205260409020541580156107225750336000908152609a6020526040812054115b1561073a57336000908152609d602052604090208390555b7f89921884d5a996127db8fd7b1c1db6e8bfa3493f23e36f87ddf8a7655c921b87338360405161076b92919061183f565b60405180910390a15b7f1449c6dd7851abc30abf37f57715f492010519147cc2652fbc38202c18a6ee903384346040516107a79392919061186b565b60405180910390a1506107ba6001606555565b5050565b6107c73361080e565b6107e35760405162461bcd60e51b81526004016105969061188c565b6001600160a01b03919091166000908152609760205260409020805460ff1916911515919091179055565b6001600160a01b031660009081526097602052604090205460ff1690565b6108353361080e565b6108515760405162461bcd60e51b81526004016105969061188c565b61085b338261115c565b50565b6108673361080e565b6108835760405162461bcd60e51b81526004016105969061188c565b61088b611275565b565b6108963361080e565b6108b25760405162461bcd60e51b81526004016105969061188c565b609c55565b60006108c2826104c5565b5192915050565b6000609c548310156108dd5750606c61091f565b6001600160a01b0382166000908152609d60205260408120549081158015906109065750818510155b905080610914576068610917565b60705b60ff16925050505b92915050565b600054610100900460ff16158080156109455750600054600160ff909116105b8061095f5750303b15801561095f575060005460ff166001145b61097b5760405162461bcd60e51b8152600401610596906118b3565b6000805460ff19166001179055801561099e576000805461ff0019166101001790555b336000908152609760205260409020805460ff19166001179055801561085b576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b610a093361080e565b610a255760405162461bcd60e51b81526004016105969061188c565b61088b6112c7565b6060600080610a51846001600160a01b03166000908152609a602052604090205490565b905060008167ffffffffffffffff811115610a6e57610a6e61156e565b604051908082528060200260200182016040528015610a97578160200160208202803683370190505b50905060005b828414610b1e57600081815260996020908152604091829020825160608101845281546001600160a01b039081168083526001840154948301949094526002909201549381019390935288169003610b155781838680600101975081518110610b0857610b086117f3565b6020026020010181815250505b50600101610a9d565b50949350505050565b610b2f610f7b565b610b37610fd4565b6000805b83811015610c22576000858583818110610b5757610b576117f3565b905060200201359050610b6981611304565b60006064610b7783336108c9565b336000908152609860209081526040808320878452909152902054610b9c9190611901565b610ba69190611918565b9050610bb281856117e0565b33600081815260986020908152604080832087845290915280822091909155519195507f987d620f307ff6b94d58743cb7a7509f24071586a77759b77c2d4e29f75a2f9a91610c0591908590859061186b565b60405180910390a150508080610c1a90611826565b915050610b3b565b50610c2c8261101a565b33600090815260986020908152604080832085845290915281208054839290610c569084906117e0565b90915550506040517f1449c6dd7851abc30abf37f57715f492010519147cc2652fbc38202c18a6ee9090610c8f9033908590859061186b565b60405180910390a150610ca26001606555565b505050565b610caf610f7b565b610cb7610fd4565b610cc082611304565b60006064610cce84336108c9565b336000908152609860209081526040808320888452909152902054610cf39190611901565b610cfd9190611918565b336000908152609860209081526040808320878452909152812055825190915015610e4a57815160005b81811015610ddc576000848281518110610d4357610d436117f3565b60200260200101519050336001600160a01b0316610d60826108b7565b6001600160a01b031614610da25760405162461bcd60e51b81526020600482015260096024820152682737ba1027bbb732b960b91b6044820152606401610596565b6000610dad826104c5565b600081529050610dbd8183611078565b610dc78233611367565b50508080610dd490611826565b915050610d27565b50610de733826113a6565b336000908152609a6020526040902054600003610e0f57336000908152609d60205260408120555b7fbfb52d6d1d8481c60e2052cc781d7579f8ab29ee08e890cb8881f27f72c48b383384604051610e4092919061183f565b60405180910390a1505b610e54338261115c565b7f987d620f307ff6b94d58743cb7a7509f24071586a77759b77c2d4e29f75a2f9a3384836040516107a79392919061186b565b600054600290610100900460ff16158015610ea9575060005460ff8083169116105b610ec55760405162461bcd60e51b8152600401610596906118b3565b6000805461ffff191660ff831617610100179055610ee16113ce565b610eea826113f5565b6004609c556000805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b610f3d3361080e565b610f595760405162461bcd60e51b81526004016105969061188c565b609b80546001600160a01b0319166001600160a01b0392909216919091179055565b600260655403610fcd5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610596565b6002606555565b60335460ff161561088b5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610596565b6000806110268361141c565b915091508142108061103757508042115b15610ca25760405162461bcd60e51b815260206004820152601160248201527014dd185ad9481b9bdd08195b98589b1959607a1b6044820152606401610596565b600090815260996020908152604091829020835181546001600160a01b0319166001600160a01b03909116178155908301516001820155910151600290910155565b609b54604051632142170760e11b81526001600160a01b03838116600483015230602483015260448201859052909116906342842e0e906064015b600060405180830381600087803b15801561110f57600080fd5b505af1158015611123573d6000803e3d6000fd5b505050505050565b6001600160a01b0382166000908152609a6020526040812080548392906111539084906117e0565b90915550505050565b804710156111ac5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610596565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146111f9576040519150601f19603f3d011682016040523d82523d6000602084013e6111fe565b606091505b5050905080610ca25760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610596565b61127d611458565b6033805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6112cf610fd4565b6033805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586112aa3390565b600061130f8261141c565b915060009050611322623b5380836117e0565b9050804211610ca25760405162461bcd60e51b815260206004820152601160248201527010db185a5b481b9bdd08195b98589b1959607a1b6044820152606401610596565b609b54604051632142170760e11b81523060048201526001600160a01b03838116602483015260448201859052909116906342842e0e906064016110f5565b6001600160a01b0382166000908152609a60205260408120805483929061115390849061193a565b600054610100900460ff1661088b5760405162461bcd60e51b81526004016105969061194d565b600054610100900460ff16610f595760405162461bcd60e51b81526004016105969061194d565b6000808061142d620d2f0085611901565b61143b906364108bf06117e0565b9050600061144c6203f480836117e0565b91959194509092505050565b60335460ff1661088b5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610596565b6000602082840312156114b357600080fd5b5035919050565b6001600160a01b038116811461085b57600080fd5b6000806000806000608086880312156114e757600080fd5b85356114f2816114ba565b94506020860135611502816114ba565b935060408601359250606086013567ffffffffffffffff8082111561152657600080fd5b818801915088601f83011261153a57600080fd5b81358181111561154957600080fd5b89602082850101111561155b57600080fd5b9699959850939650602001949392505050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561159757600080fd5b8235915060208084013567ffffffffffffffff808211156115b757600080fd5b818601915086601f8301126115cb57600080fd5b8135818111156115dd576115dd61156e565b8060051b604051601f19603f830116810181811085821117156116025761160261156e565b60405291825284820192508381018501918983111561162057600080fd5b938501935b8285101561163e57843584529385019392850192611625565b8096505050505050509250929050565b6000806040838503121561166157600080fd5b823561166c816114ba565b91506020830135801515811461168157600080fd5b809150509250929050565b60006020828403121561169e57600080fd5b81356116a9816114ba565b9392505050565b600080604083850312156116c357600080fd5b823591506020830135611681816114ba565b600081518084526020808501945080840160005b83811015611705578151875295820195908201906001016116e9565b509495945050505050565b6020815260006116a960208301846116d5565b60008060006040848603121561173857600080fd5b833567ffffffffffffffff8082111561175057600080fd5b818601915086601f83011261176457600080fd5b81358181111561177357600080fd5b8760208260051b850101111561178857600080fd5b6020928301989097509590910135949350505050565b600080604083850312156117b157600080fd5b82356117bc816114ba565b946020939093013593505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561091f5761091f6117ca565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561181b57600080fd5b81516116a9816114ba565b600060018201611838576118386117ca565b5060010190565b6001600160a01b0383168152604060208201819052600090611863908301846116d5565b949350505050565b6001600160a01b039390931683526020830191909152604082015260600190565b6020808252600d908201526c2737ba1030b7321030b236b4b760991b604082015260600190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b808202811582820484141761091f5761091f6117ca565b60008261193557634e487b7160e01b600052601260045260246000fd5b500490565b8181038181111561091f5761091f6117ca565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fea2646970667358221220caaa1bf92bda72d1976fb702449c55ceb1ddf489ebefb8d3e6420ed91a8aa15d64736f6c63430008110033

Deployed Bytecode

0x6080604052600436106101445760003560e01c806370a08231116100b6578063aedb71c11161006f578063aedb71c1146103ea578063b1b6665214610417578063cbf1304d14610437578063f3c479d81461046f578063f4cd24f214610485578063f56e9c66146104a557600080fd5b806370a082311461030f57806377479a69146103535780638129fc1c146103735780638456cb59146103885780638462151c1461039d5780639a562695146103ca57600080fd5b80632e1a7d4d116101085780632e1a7d4d1461024a5780633f4ba83a1461026a57806347ccca021461027f5780635c975abb146102b75780635de78afd146102cf5780636352211e146102ef57600080fd5b8063044215c614610150578063150b7a02146101a057806316f60557146101e5578063240ff27f146101fa57806324d7806c1461021a57600080fd5b3661014b57005b600080fd5b34801561015c57600080fd5b5061017061016b3660046114a1565b6104c5565b6040805182516001600160a01b031681526020808401519082015291810151908201526060015b60405180910390f35b3480156101ac57600080fd5b506101cc6101bb3660046114cf565b630a85bd0160e11b95945050505050565b6040516001600160e01b03199091168152602001610197565b6101f86101f3366004611584565b610534565b005b34801561020657600080fd5b506101f861021536600461164e565b6107be565b34801561022657600080fd5b5061023a61023536600461168c565b61080e565b6040519015158152602001610197565b34801561025657600080fd5b506101f86102653660046114a1565b61082c565b34801561027657600080fd5b506101f861085e565b34801561028b57600080fd5b50609b5461029f906001600160a01b031681565b6040516001600160a01b039091168152602001610197565b3480156102c357600080fd5b5060335460ff1661023a565b3480156102db57600080fd5b506101f86102ea3660046114a1565b61088d565b3480156102fb57600080fd5b5061029f61030a3660046114a1565b6108b7565b34801561031b57600080fd5b5061034561032a36600461168c565b6001600160a01b03166000908152609a602052604090205490565b604051908152602001610197565b34801561035f57600080fd5b5061034561036e3660046116b0565b6108c9565b34801561037f57600080fd5b506101f8610925565b34801561039457600080fd5b506101f8610a00565b3480156103a957600080fd5b506103bd6103b836600461168c565b610a2d565b6040516101979190611710565b3480156103d657600080fd5b506101f86103e5366004611723565b610b27565b3480156103f657600080fd5b5061034561040536600461168c565b609d6020526000908152604090205481565b34801561042357600080fd5b506101f8610432366004611584565b610ca7565b34801561044357600080fd5b5061034561045236600461179e565b609860209081526000928352604080842090915290825290205481565b34801561047b57600080fd5b50610345609c5481565b34801561049157600080fd5b506101f86104a036600461168c565b610e87565b3480156104b157600080fd5b506101f86104c036600461168c565b610f34565b6104f2604051806060016040528060006001600160a01b0316815260200160008152602001600081525090565b50600090815260996020908152604091829020825160608101845281546001600160a01b03168152600182015492810192909252600201549181019190915290565b61053c610f7b565b610544610fd4565b61054d8261101a565b67016345785d8a000034101561059f5760405162461bcd60e51b8152602060048201526012602482015271125b9d985b1a590811551208185b5bdd5b9d60721b60448201526064015b60405180910390fd5b336000908152609860209081526040808320858452909152812080543492906105c99084906117e0565b9091555050805180156107745760005b818110156106ed5760008382815181106105f5576105f56117f3565b6020908102919091010151609b546040516331a9108f60e11b81526004810183905291925033916001600160a01b0390911690636352211e90602401602060405180830381865afa15801561064e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106729190611809565b6001600160a01b0316146106b45760405162461bcd60e51b81526020600482015260096024820152682737ba1027bbb732b960b91b6044820152606401610596565b60006106bf826104c5565b33815290506106ce8183611078565b6106d882336110ba565b505080806106e590611826565b9150506105d9565b506106f8338261112b565b336000908152609d60205260409020541580156107225750336000908152609a6020526040812054115b1561073a57336000908152609d602052604090208390555b7f89921884d5a996127db8fd7b1c1db6e8bfa3493f23e36f87ddf8a7655c921b87338360405161076b92919061183f565b60405180910390a15b7f1449c6dd7851abc30abf37f57715f492010519147cc2652fbc38202c18a6ee903384346040516107a79392919061186b565b60405180910390a1506107ba6001606555565b5050565b6107c73361080e565b6107e35760405162461bcd60e51b81526004016105969061188c565b6001600160a01b03919091166000908152609760205260409020805460ff1916911515919091179055565b6001600160a01b031660009081526097602052604090205460ff1690565b6108353361080e565b6108515760405162461bcd60e51b81526004016105969061188c565b61085b338261115c565b50565b6108673361080e565b6108835760405162461bcd60e51b81526004016105969061188c565b61088b611275565b565b6108963361080e565b6108b25760405162461bcd60e51b81526004016105969061188c565b609c55565b60006108c2826104c5565b5192915050565b6000609c548310156108dd5750606c61091f565b6001600160a01b0382166000908152609d60205260408120549081158015906109065750818510155b905080610914576068610917565b60705b60ff16925050505b92915050565b600054610100900460ff16158080156109455750600054600160ff909116105b8061095f5750303b15801561095f575060005460ff166001145b61097b5760405162461bcd60e51b8152600401610596906118b3565b6000805460ff19166001179055801561099e576000805461ff0019166101001790555b336000908152609760205260409020805460ff19166001179055801561085b576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b610a093361080e565b610a255760405162461bcd60e51b81526004016105969061188c565b61088b6112c7565b6060600080610a51846001600160a01b03166000908152609a602052604090205490565b905060008167ffffffffffffffff811115610a6e57610a6e61156e565b604051908082528060200260200182016040528015610a97578160200160208202803683370190505b50905060005b828414610b1e57600081815260996020908152604091829020825160608101845281546001600160a01b039081168083526001840154948301949094526002909201549381019390935288169003610b155781838680600101975081518110610b0857610b086117f3565b6020026020010181815250505b50600101610a9d565b50949350505050565b610b2f610f7b565b610b37610fd4565b6000805b83811015610c22576000858583818110610b5757610b576117f3565b905060200201359050610b6981611304565b60006064610b7783336108c9565b336000908152609860209081526040808320878452909152902054610b9c9190611901565b610ba69190611918565b9050610bb281856117e0565b33600081815260986020908152604080832087845290915280822091909155519195507f987d620f307ff6b94d58743cb7a7509f24071586a77759b77c2d4e29f75a2f9a91610c0591908590859061186b565b60405180910390a150508080610c1a90611826565b915050610b3b565b50610c2c8261101a565b33600090815260986020908152604080832085845290915281208054839290610c569084906117e0565b90915550506040517f1449c6dd7851abc30abf37f57715f492010519147cc2652fbc38202c18a6ee9090610c8f9033908590859061186b565b60405180910390a150610ca26001606555565b505050565b610caf610f7b565b610cb7610fd4565b610cc082611304565b60006064610cce84336108c9565b336000908152609860209081526040808320888452909152902054610cf39190611901565b610cfd9190611918565b336000908152609860209081526040808320878452909152812055825190915015610e4a57815160005b81811015610ddc576000848281518110610d4357610d436117f3565b60200260200101519050336001600160a01b0316610d60826108b7565b6001600160a01b031614610da25760405162461bcd60e51b81526020600482015260096024820152682737ba1027bbb732b960b91b6044820152606401610596565b6000610dad826104c5565b600081529050610dbd8183611078565b610dc78233611367565b50508080610dd490611826565b915050610d27565b50610de733826113a6565b336000908152609a6020526040902054600003610e0f57336000908152609d60205260408120555b7fbfb52d6d1d8481c60e2052cc781d7579f8ab29ee08e890cb8881f27f72c48b383384604051610e4092919061183f565b60405180910390a1505b610e54338261115c565b7f987d620f307ff6b94d58743cb7a7509f24071586a77759b77c2d4e29f75a2f9a3384836040516107a79392919061186b565b600054600290610100900460ff16158015610ea9575060005460ff8083169116105b610ec55760405162461bcd60e51b8152600401610596906118b3565b6000805461ffff191660ff831617610100179055610ee16113ce565b610eea826113f5565b6004609c556000805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b610f3d3361080e565b610f595760405162461bcd60e51b81526004016105969061188c565b609b80546001600160a01b0319166001600160a01b0392909216919091179055565b600260655403610fcd5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610596565b6002606555565b60335460ff161561088b5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610596565b6000806110268361141c565b915091508142108061103757508042115b15610ca25760405162461bcd60e51b815260206004820152601160248201527014dd185ad9481b9bdd08195b98589b1959607a1b6044820152606401610596565b600090815260996020908152604091829020835181546001600160a01b0319166001600160a01b03909116178155908301516001820155910151600290910155565b609b54604051632142170760e11b81526001600160a01b03838116600483015230602483015260448201859052909116906342842e0e906064015b600060405180830381600087803b15801561110f57600080fd5b505af1158015611123573d6000803e3d6000fd5b505050505050565b6001600160a01b0382166000908152609a6020526040812080548392906111539084906117e0565b90915550505050565b804710156111ac5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610596565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146111f9576040519150601f19603f3d011682016040523d82523d6000602084013e6111fe565b606091505b5050905080610ca25760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610596565b61127d611458565b6033805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6112cf610fd4565b6033805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586112aa3390565b600061130f8261141c565b915060009050611322623b5380836117e0565b9050804211610ca25760405162461bcd60e51b815260206004820152601160248201527010db185a5b481b9bdd08195b98589b1959607a1b6044820152606401610596565b609b54604051632142170760e11b81523060048201526001600160a01b03838116602483015260448201859052909116906342842e0e906064016110f5565b6001600160a01b0382166000908152609a60205260408120805483929061115390849061193a565b600054610100900460ff1661088b5760405162461bcd60e51b81526004016105969061194d565b600054610100900460ff16610f595760405162461bcd60e51b81526004016105969061194d565b6000808061142d620d2f0085611901565b61143b906364108bf06117e0565b9050600061144c6203f480836117e0565b91959194509092505050565b60335460ff1661088b5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610596565b6000602082840312156114b357600080fd5b5035919050565b6001600160a01b038116811461085b57600080fd5b6000806000806000608086880312156114e757600080fd5b85356114f2816114ba565b94506020860135611502816114ba565b935060408601359250606086013567ffffffffffffffff8082111561152657600080fd5b818801915088601f83011261153a57600080fd5b81358181111561154957600080fd5b89602082850101111561155b57600080fd5b9699959850939650602001949392505050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561159757600080fd5b8235915060208084013567ffffffffffffffff808211156115b757600080fd5b818601915086601f8301126115cb57600080fd5b8135818111156115dd576115dd61156e565b8060051b604051601f19603f830116810181811085821117156116025761160261156e565b60405291825284820192508381018501918983111561162057600080fd5b938501935b8285101561163e57843584529385019392850192611625565b8096505050505050509250929050565b6000806040838503121561166157600080fd5b823561166c816114ba565b91506020830135801515811461168157600080fd5b809150509250929050565b60006020828403121561169e57600080fd5b81356116a9816114ba565b9392505050565b600080604083850312156116c357600080fd5b823591506020830135611681816114ba565b600081518084526020808501945080840160005b83811015611705578151875295820195908201906001016116e9565b509495945050505050565b6020815260006116a960208301846116d5565b60008060006040848603121561173857600080fd5b833567ffffffffffffffff8082111561175057600080fd5b818601915086601f83011261176457600080fd5b81358181111561177357600080fd5b8760208260051b850101111561178857600080fd5b6020928301989097509590910135949350505050565b600080604083850312156117b157600080fd5b82356117bc816114ba565b946020939093013593505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561091f5761091f6117ca565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561181b57600080fd5b81516116a9816114ba565b600060018201611838576118386117ca565b5060010190565b6001600160a01b0383168152604060208201819052600090611863908301846116d5565b949350505050565b6001600160a01b039390931683526020830191909152604082015260600190565b6020808252600d908201526c2737ba1030b7321030b236b4b760991b604082015260600190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b808202811582820484141761091f5761091f6117ca565b60008261193557634e487b7160e01b600052601260045260246000fd5b500490565b8181038181111561091f5761091f6117ca565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fea2646970667358221220caaa1bf92bda72d1976fb702449c55ceb1ddf489ebefb8d3e6420ed91a8aa15d64736f6c63430008110033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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