ETH Price: $2,498.75 (-0.70%)

Contract

0x0DcBE55Eb136F59A0d37f4E69cE809b3eC99dFb7
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Initialize152557552022-08-01 9:12:44764 days ago1659345164IN
0x0DcBE55E...3eC99dFb7
0 ETH0.0011322916.67623145
0x60806040152554932022-08-01 8:18:43764 days ago1659341923IN
 Create: IOStaking
0 ETH0.0198377116.007298

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
IOStaking

Compiler Version
v0.8.6+commit.11564f7e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 8 : staking.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";

contract IOStaking is Initializable, ReentrancyGuardUpgradeable {
    // Contract state v1 (do not change) ----

    // General state
    address public owner;
    bool public paused;

    // NFT connected to this staking contract
    mapping(address => bool) public stakableContractAddresses;
    mapping(address => bool) public disallowNewStaking;

    // Ranking timing
    mapping(address => uint256[]) public rankTime;

    // Staking records
    mapping(address => mapping(uint256 => uint256)) public stakedTokenTime;
    mapping(address => mapping(uint256 => address)) public stakedOwner;

    // End of contract state v1 (append new state after this) ----

    struct TokenOwner {
        uint256 id;
        address owner;
    }

    // Events
    event Staked(address indexed holderAddress, uint256[] tokenIDs);
    event Unstaked(address indexed holderAddress, uint256[] tokenIDs);

    // Errors
    error GlobalStakingPaused();
    error DirectStakingNotAllowed();
    error NotStakableContractAddress(address nftAddress);
    error StakingPaused(address nftAddress);
    error TokenAlreadyStaked();
    error CallerNotNFTOwner();
    error NFTNotStaked();
    error ContractIsNot721();
    error RankNotMonotonic();
    error CallerIsNotContractOwner();

    // Modifiers
    modifier contractNotPaused() {
        if (paused) revert GlobalStakingPaused();
        _;
    }

    modifier isStakable(address nftAddr) {
        if (!stakableContractAddresses[nftAddr])
            revert NotStakableContractAddress({nftAddress: nftAddr});
        _;
    }

    // Functions
    // Upgradable contract initializer
    function initialize(address ownerData) public initializer {
        owner = ownerData;
        paused = true;
    }

    function supportsInterface(bytes4 interfaceId) public pure returns (bool) {
        return interfaceId == type(IERC721Receiver).interfaceId;
    }

    function onERC721Received(
        address operator,
        address,
        uint256,
        bytes calldata
    ) external returns (bytes4) {
        if (operator != address(this)) revert DirectStakingNotAllowed();
        return
            bytes4(
                keccak256("onERC721Received(address,address,uint256,bytes)")
            );
    }

    // Staking - Requires approve or SetApprovalForAll first
    function stake(address nftContract, uint256[] calldata tokenIds)
        public
        contractNotPaused
        isStakable(nftContract)
        nonReentrant
    {
        if (disallowNewStaking[nftContract])
            revert StakingPaused(nftContract);

        for (uint256 i; i < tokenIds.length; ) {
            uint256 tokenId = tokenIds[i];

            if (stakedOwner[nftContract][tokenId] != address(0))
                revert TokenAlreadyStaked();

            stakedTokenTime[nftContract][tokenId] = block.timestamp;
            stakedOwner[nftContract][tokenId] = msg.sender;

            IERC721(nftContract).safeTransferFrom(
                msg.sender,
                address(this),
                tokenId
            );

            unchecked {
                ++i;
            }
        }

        emit Staked(msg.sender, tokenIds);
    }

    // Unstake
    function unstake(address nftContract, uint256[] calldata tokenIds)
        public
        contractNotPaused
        isStakable(nftContract)
        nonReentrant
    {
        for (uint256 i; i < tokenIds.length; ) {
            uint256 tokenId = tokenIds[i];

            if (stakedOwner[nftContract][tokenId] != msg.sender)
                revert CallerNotNFTOwner();

            _unstake(nftContract, tokenId, msg.sender);

            unchecked {
                ++i;
            }
        }

        emit Unstaked(msg.sender, tokenIds);
    }

    function _unstake(
        address nftContract,
        uint256 tokenId,
        address ownerAddress
    ) private {
        // Reset staking time
        delete stakedTokenTime[nftContract][tokenId];
        delete stakedOwner[nftContract][tokenId];

        // Return staked tokens
        IERC721(nftContract).safeTransferFrom(
            address(this),
            ownerAddress,
            tokenId
        );
    }

    function getStakedOwner(address nftContract, uint256 tokenId)
        public
        view
        isStakable(nftContract)
        returns (address)
    {
        if (stakedOwner[nftContract][tokenId] == address(0))
            revert NFTNotStaked();

        return stakedOwner[nftContract][tokenId];
    }

    function totalBalanceOf(
        address nftContract,
        address holder,
        uint256 startIndex,
        uint256 endIndex
    ) public view returns (uint256) {
        uint256 count;
        unchecked {
            for (uint256 i = startIndex; i <= endIndex; ++i) {
                if (stakedOwner[nftContract][i] == holder) {
                    ++count;
                }
            }
        }

        return count;
    }

    function getStakedTokenIds(
        address nftContract,
        address holder,
        uint256 startIndex,
        uint256 endIndex
    ) public view returns (uint256[] memory) {
        uint256 count = totalBalanceOf(
            nftContract,
            holder,
            startIndex,
            endIndex
        );
        uint256 idx = 0;
        uint256[] memory ownedIds = new uint256[](count);
        unchecked {
            for (uint256 i = startIndex; i <= endIndex; ++i) {
                if (stakedOwner[nftContract][i] == holder) ownedIds[idx++] = i;

            }
        }

        return ownedIds;
    }

    function tokenOwnersCount(
        address nftContract,
        uint256 startIndex,
        uint256 endIndex
    ) public view returns (uint256) {
        uint256 count;
        unchecked {
            for (uint256 i = startIndex; i <= endIndex; ++i) {
                if (stakedOwner[nftContract][i] != address(0)) {
                    ++count;
                }
            }
        }

        return count;
    }

    function getTokenOwners(
        address nftContract,
        uint256 startIndex,
        uint256 endIndex
    ) public view returns (TokenOwner[] memory) {
        TokenOwner[] memory tokenOwners = new TokenOwner[](
            tokenOwnersCount(nftContract, startIndex, endIndex)
        );

        uint256 counter;
        unchecked {
            for (uint256 i = startIndex; i <= endIndex; ++i) {
                if (stakedOwner[nftContract][i] != address(0)) {
                    tokenOwners[counter] = TokenOwner(
                        i,
                        stakedOwner[nftContract][i]
                    );
                    ++counter;
                }
            }
        }

        return tokenOwners;
    }

    // Admin functions
    modifier ownerOnly() {
        if (msg.sender != owner) revert CallerIsNotContractOwner();
        _;
    }

    function changeOwnership(address newOwner) public ownerOnly {
        owner = newOwner;
    }

    function setPaused(bool pause) public ownerOnly {
        paused = pause;
    }

    function addStakableNFT(address nftContract) private {
        if (!ERC165(nftContract).supportsInterface(type(IERC721).interfaceId))
            revert ContractIsNot721();

        stakableContractAddresses[nftContract] = true;
    }

    function setDisallowNewStake(address nftContract, bool state)
        public
        isStakable(nftContract)
        ownerOnly
    {
        disallowNewStaking[nftContract] = state;
    }

    function setRanking(address nftContract, uint256[] calldata rankTimeData)
        public
        ownerOnly
    {
        if (!stakableContractAddresses[nftContract]) {
            addStakableNFT(nftContract);
        }

        // Check rankTimeData is monotonic increasing
        unchecked {
            for (uint256 i = 1; i < rankTimeData.length; ++i) {
                if (rankTimeData[i] <= rankTimeData[i - 1]) revert RankNotMonotonic();
            }
        }

        rankTime[nftContract] = rankTimeData;
    }

    // Emergency release particular staked token/s of a particular contract address to original wallet
    function emergencyReleaseToken(
        address nftContract,
        uint256[] calldata tokenIds
    ) public isStakable(nftContract) ownerOnly {
        for (uint256 i; i < tokenIds.length; ) {
            uint256 tokenId = tokenIds[i];
            // Get the owner of token
            address ownerAddress = stakedOwner[nftContract][tokenId];
            if (ownerAddress != address(0))
                _unstake(nftContract, tokenId, ownerAddress);

            unchecked {
                ++i;
            }
        }
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: 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);
}

File 3 of 8 : 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);
}

File 4 of 8 : ERC165.sol
// 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;
    }
}

File 5 of 8 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (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. Equivalent to `reinitializer(1)`.
     */
    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.
     *
     * `initializer` is equivalent to `reinitializer(1)`, so 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.
     *
     * 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.
     */
    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.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized < type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }
}

File 6 of 8 : ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

        _;

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

    /**
     * @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 8 : IERC165.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 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);
}

File 8 of 8 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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 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 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
                /// @solidity memory-safe-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[],"name":"CallerIsNotContractOwner","type":"error"},{"inputs":[],"name":"CallerNotNFTOwner","type":"error"},{"inputs":[],"name":"ContractIsNot721","type":"error"},{"inputs":[],"name":"DirectStakingNotAllowed","type":"error"},{"inputs":[],"name":"GlobalStakingPaused","type":"error"},{"inputs":[],"name":"NFTNotStaked","type":"error"},{"inputs":[{"internalType":"address","name":"nftAddress","type":"address"}],"name":"NotStakableContractAddress","type":"error"},{"inputs":[],"name":"RankNotMonotonic","type":"error"},{"inputs":[{"internalType":"address","name":"nftAddress","type":"address"}],"name":"StakingPaused","type":"error"},{"inputs":[],"name":"TokenAlreadyStaked","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"holderAddress","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"tokenIDs","type":"uint256[]"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"holderAddress","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"tokenIDs","type":"uint256[]"}],"name":"Unstaked","type":"event"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"changeOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"disallowNewStaking","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"emergencyReleaseToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getStakedOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"address","name":"holder","type":"address"},{"internalType":"uint256","name":"startIndex","type":"uint256"},{"internalType":"uint256","name":"endIndex","type":"uint256"}],"name":"getStakedTokenIds","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"uint256","name":"startIndex","type":"uint256"},{"internalType":"uint256","name":"endIndex","type":"uint256"}],"name":"getTokenOwners","outputs":[{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"owner","type":"address"}],"internalType":"struct IOStaking.TokenOwner[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"ownerData","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","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":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"rankTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"bool","name":"state","type":"bool"}],"name":"setDisallowNewStake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"pause","type":"bool"}],"name":"setPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"uint256[]","name":"rankTimeData","type":"uint256[]"}],"name":"setRanking","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"stakableContractAddresses","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"stakedOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"stakedTokenTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"uint256","name":"startIndex","type":"uint256"},{"internalType":"uint256","name":"endIndex","type":"uint256"}],"name":"tokenOwnersCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"address","name":"holder","type":"address"},{"internalType":"uint256","name":"startIndex","type":"uint256"},{"internalType":"uint256","name":"endIndex","type":"uint256"}],"name":"totalBalanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50611574806100206000396000f3fe608060405234801561001057600080fd5b50600436106101425760003560e01c806368df333c116100b8578063945a58e01161007c578063945a58e014610324578063c4d66de814610358578063c4f3cd081461036b578063c9a3911e1461038b578063e74c07c91461039e578063f92bec27146103b157600080fd5b806368df333c1461029d5780636f211bcf146102c05780637935979c146102d35780638da5cb5b146102fe5780638e18234b1461031157600080fd5b80633dddee481161010a5780633dddee48146101f55780634d0ce3bd14610218578063515b81cc146102385780635c975abb1461024b5780635dbe47561461025f57806363187ebb1461027257600080fd5b806301ffc9a7146101475780630cfa0caf14610180578063150b7a02146101a157806316c38b3c146101cd5780632af4c31e146101e2575b600080fd5b61016b6101553660046113ff565b6001600160e01b031916630a85bd0160e11b1490565b60405190151581526020015b60405180910390f35b61019361018e366004611392565b6103c4565b604051908152602001610177565b6101b46101af3660046111ce565b610413565b6040516001600160e01b03199091168152602001610177565b6101e06101db3660046113c5565b610469565b005b6101e06101f03660046111ac565b6104b2565b61016b6102033660046111ac565b60356020526000908152604090205460ff1681565b61022b610226366004611392565b6104ff565b6040516101779190611429565b6101e06102463660046112ab565b610614565b60335461016b90600160a01b900460ff1681565b6101e061026d3660046112ab565b610702565b610193610280366004611368565b603760209081526000928352604080842090915290825290205481565b61016b6102ab3660046111ac565b60346020526000908152604090205460ff1681565b6101936102ce366004611368565b6108a2565b6102e66102e1366004611368565b6108d3565b6040516001600160a01b039091168152602001610177565b6033546102e6906001600160a01b031681565b6101e061031f3660046112ab565b610986565b6102e6610332366004611368565b60386020908152600092835260408084209091529082529020546001600160a01b031681565b6101e06103663660046111ac565b610a6a565b61037e610379366004611269565b610b95565b60405161017791906114bd565b6101e06103993660046112ab565b610c62565b6101936103ac366004611269565b610ed5565b6101e06103bf366004611331565b610f2a565b600080835b83811161040a576001600160a01b0386811660009081526038602090815260408083208584529091529020541615610402578160010191505b6001016103c9565b50949350505050565b60006001600160a01b038616301461043e57604051639986019f60e01b815260040160405180910390fd5b507f150b7a023d4804d13e8c85fb27262cb750cf6ba9f9dd3bb30d90f482ceeb4b1f95945050505050565b6033546001600160a01b0316331461049457604051633d74f23360e21b815260040160405180910390fd5b60338054911515600160a01b0260ff60a01b19909216919091179055565b6033546001600160a01b031633146104dd57604051633d74f23360e21b815260040160405180910390fd5b603380546001600160a01b0319166001600160a01b0392909216919091179055565b6060600061050e8585856103c4565b67ffffffffffffffff81111561052657610526611517565b60405190808252806020026020018201604052801561056b57816020015b60408051808201909152600080825260208201528152602001906001900390816105445790505b5090506000845b848111610609576001600160a01b0387811660009081526038602090815260408083208584529091529020541615610601576040805180820182528281526001600160a01b03808a16600090815260386020908152848220868352815293902054169181019190915283518490849081106105ef576105ef611501565b60200260200101819052508160010191505b600101610572565b509095945050505050565b6001600160a01b038316600090815260346020526040902054839060ff1661065f576040516304fc6af960e21b81526001600160a01b03821660048201526024015b60405180910390fd5b6033546001600160a01b0316331461068a57604051633d74f23360e21b815260040160405180910390fd5b60005b828110156106fb5760008484838181106106a9576106a9611501565b6001600160a01b03808a16600090815260386020908152604080832094820296909601358083529390529390932054909350909116905080156106f1576106f1878383610fc7565b505060010161068d565b5050505050565b603354600160a01b900460ff161561072d5760405163473bc3c560e01b815260040160405180910390fd5b6001600160a01b038316600090815260346020526040902054839060ff16610773576040516304fc6af960e21b81526001600160a01b0382166004820152602401610656565b600260015414156107c65760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610656565b600260015560005b828110156108545760008484838181106107ea576107ea611501565b6001600160a01b038981166000908152603860209081526040808320948202969096013580835293905293909320549093509091163314905061084057604051632a29eae960e21b815260040160405180910390fd5b61084b868233610fc7565b506001016107ce565b50336001600160a01b03167f20748b935fd9f21155c2e98cb2bd5df6fe86f21b193cebaae8d9ad7db0ba54168484604051610890929190611481565b60405180910390a25050600180555050565b603660205281600052604060002081815481106108be57600080fd5b90600052602060002001600091509150505481565b6001600160a01b038216600090815260346020526040812054839060ff16610919576040516304fc6af960e21b81526001600160a01b0382166004820152602401610656565b6001600160a01b0384811660009081526038602090815260408083208784529091529020541661095c5760405163da70723f60e01b815260040160405180910390fd5b50506001600160a01b03918216600090815260386020908152604080832093835292905220541690565b6033546001600160a01b031633146109b157604051633d74f23360e21b815260040160405180910390fd5b6001600160a01b03831660009081526034602052604090205460ff166109da576109da83611071565b60015b81811015610a40578282600183038181106109fa576109fa611501565b90506020020135838383818110610a1357610a13611501565b9050602002013511610a385760405163b24aa19560e01b815260040160405180910390fd5b6001016109dd565b506001600160a01b0383166000908152603660205260409020610a64908383611130565b50505050565b600054610100900460ff1615808015610a8a5750600054600160ff909116105b80610aa45750303b158015610aa4575060005460ff166001145b610b075760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610656565b6000805460ff191660011790558015610b2a576000805461ff0019166101001790555b603380546001600160a81b0319166001600160a01b03841617600160a01b1790558015610b91576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050565b60606000610ba586868686610ed5565b90506000808267ffffffffffffffff811115610bc357610bc3611517565b604051908082528060200260200182016040528015610bec578160200160208202803683370190505b509050855b858111610c56576001600160a01b03898116600090815260386020908152604080832085845290915290205481169089161415610c4e5780828480600101955081518110610c4157610c41611501565b6020026020010181815250505b600101610bf1565b50979650505050505050565b603354600160a01b900460ff1615610c8d5760405163473bc3c560e01b815260040160405180910390fd5b6001600160a01b038316600090815260346020526040902054839060ff16610cd3576040516304fc6af960e21b81526001600160a01b0382166004820152602401610656565b60026001541415610d265760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610656565b60026001556001600160a01b03841660009081526035602052604090205460ff1615610d7057604051630101380b60e71b81526001600160a01b0385166004820152602401610656565b60005b82811015610e99576000848483818110610d8f57610d8f611501565b6001600160a01b03898116600090815260386020908152604080832094820296909601358083529390529390932054909350909116159050610de4576040516316e9ad8f60e01b815260040160405180910390fd5b6001600160a01b03861660008181526037602090815260408083208584528252808320429055838352603882528083208584529091529081902080546001600160a01b031916339081179091559051632142170760e11b81526004810191909152306024820152604481018390526342842e0e90606401600060405180830381600087803b158015610e7557600080fd5b505af1158015610e89573d6000803e3d6000fd5b5050505081600101915050610d73565b50336001600160a01b03167f134b166c6094cc1ccbf1e3353ce5c3cd9fd29869051bdb999895854d77cc5ef68484604051610890929190611481565b600080835b838111610f20576001600160a01b03878116600090815260386020908152604080832085845290915290205481169087161415610f18578160010191505b600101610eda565b5095945050505050565b6001600160a01b038216600090815260346020526040902054829060ff16610f70576040516304fc6af960e21b81526001600160a01b0382166004820152602401610656565b6033546001600160a01b03163314610f9b57604051633d74f23360e21b815260040160405180910390fd5b506001600160a01b03919091166000908152603560205260409020805460ff1916911515919091179055565b6001600160a01b0383811660008181526037602090815260408083208784528252808320839055838352603882528083208784529091529081902080546001600160a01b031916905551632142170760e11b8152306004820152918316602483015260448201849052906342842e0e90606401600060405180830381600087803b15801561105457600080fd5b505af1158015611068573d6000803e3d6000fd5b50505050505050565b6040516301ffc9a760e01b81526380ac58cd60e01b60048201526001600160a01b038216906301ffc9a79060240160206040518083038186803b1580156110b757600080fd5b505afa1580156110cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ef91906113e2565b61110c57604051632fda86bb60e21b815260040160405180910390fd5b6001600160a01b03166000908152603460205260409020805460ff19166001179055565b82805482825590600052602060002090810192821561116b579160200282015b8281111561116b578235825591602001919060010190611150565b5061117792915061117b565b5090565b5b80821115611177576000815560010161117c565b80356001600160a01b03811681146111a757600080fd5b919050565b6000602082840312156111be57600080fd5b6111c782611190565b9392505050565b6000806000806000608086880312156111e657600080fd5b6111ef86611190565b94506111fd60208701611190565b935060408601359250606086013567ffffffffffffffff8082111561122157600080fd5b818801915088601f83011261123557600080fd5b81358181111561124457600080fd5b89602082850101111561125657600080fd5b9699959850939650602001949392505050565b6000806000806080858703121561127f57600080fd5b61128885611190565b935061129660208601611190565b93969395505050506040820135916060013590565b6000806000604084860312156112c057600080fd5b6112c984611190565b9250602084013567ffffffffffffffff808211156112e657600080fd5b818601915086601f8301126112fa57600080fd5b81358181111561130957600080fd5b8760208260051b850101111561131e57600080fd5b6020830194508093505050509250925092565b6000806040838503121561134457600080fd5b61134d83611190565b9150602083013561135d8161152d565b809150509250929050565b6000806040838503121561137b57600080fd5b61138483611190565b946020939093013593505050565b6000806000606084860312156113a757600080fd5b6113b084611190565b95602085013595506040909401359392505050565b6000602082840312156113d757600080fd5b81356111c78161152d565b6000602082840312156113f457600080fd5b81516111c78161152d565b60006020828403121561141157600080fd5b81356001600160e01b0319811681146111c757600080fd5b602080825282518282018190526000919060409081850190868401855b82811015611474578151805185528601516001600160a01b0316868501529284019290850190600101611446565b5091979650505050505050565b6020808252810182905260006001600160fb1b038311156114a157600080fd5b8260051b80856040850137600092016040019182525092915050565b6020808252825182820181905260009190848201906040850190845b818110156114f5578351835292840192918401916001016114d9565b50909695505050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b801515811461153b57600080fd5b5056fea26469706673582212207a742513e4d933a966085680bd114ae7c88312b9dc87ff382040d22861e020f964736f6c63430008060033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101425760003560e01c806368df333c116100b8578063945a58e01161007c578063945a58e014610324578063c4d66de814610358578063c4f3cd081461036b578063c9a3911e1461038b578063e74c07c91461039e578063f92bec27146103b157600080fd5b806368df333c1461029d5780636f211bcf146102c05780637935979c146102d35780638da5cb5b146102fe5780638e18234b1461031157600080fd5b80633dddee481161010a5780633dddee48146101f55780634d0ce3bd14610218578063515b81cc146102385780635c975abb1461024b5780635dbe47561461025f57806363187ebb1461027257600080fd5b806301ffc9a7146101475780630cfa0caf14610180578063150b7a02146101a157806316c38b3c146101cd5780632af4c31e146101e2575b600080fd5b61016b6101553660046113ff565b6001600160e01b031916630a85bd0160e11b1490565b60405190151581526020015b60405180910390f35b61019361018e366004611392565b6103c4565b604051908152602001610177565b6101b46101af3660046111ce565b610413565b6040516001600160e01b03199091168152602001610177565b6101e06101db3660046113c5565b610469565b005b6101e06101f03660046111ac565b6104b2565b61016b6102033660046111ac565b60356020526000908152604090205460ff1681565b61022b610226366004611392565b6104ff565b6040516101779190611429565b6101e06102463660046112ab565b610614565b60335461016b90600160a01b900460ff1681565b6101e061026d3660046112ab565b610702565b610193610280366004611368565b603760209081526000928352604080842090915290825290205481565b61016b6102ab3660046111ac565b60346020526000908152604090205460ff1681565b6101936102ce366004611368565b6108a2565b6102e66102e1366004611368565b6108d3565b6040516001600160a01b039091168152602001610177565b6033546102e6906001600160a01b031681565b6101e061031f3660046112ab565b610986565b6102e6610332366004611368565b60386020908152600092835260408084209091529082529020546001600160a01b031681565b6101e06103663660046111ac565b610a6a565b61037e610379366004611269565b610b95565b60405161017791906114bd565b6101e06103993660046112ab565b610c62565b6101936103ac366004611269565b610ed5565b6101e06103bf366004611331565b610f2a565b600080835b83811161040a576001600160a01b0386811660009081526038602090815260408083208584529091529020541615610402578160010191505b6001016103c9565b50949350505050565b60006001600160a01b038616301461043e57604051639986019f60e01b815260040160405180910390fd5b507f150b7a023d4804d13e8c85fb27262cb750cf6ba9f9dd3bb30d90f482ceeb4b1f95945050505050565b6033546001600160a01b0316331461049457604051633d74f23360e21b815260040160405180910390fd5b60338054911515600160a01b0260ff60a01b19909216919091179055565b6033546001600160a01b031633146104dd57604051633d74f23360e21b815260040160405180910390fd5b603380546001600160a01b0319166001600160a01b0392909216919091179055565b6060600061050e8585856103c4565b67ffffffffffffffff81111561052657610526611517565b60405190808252806020026020018201604052801561056b57816020015b60408051808201909152600080825260208201528152602001906001900390816105445790505b5090506000845b848111610609576001600160a01b0387811660009081526038602090815260408083208584529091529020541615610601576040805180820182528281526001600160a01b03808a16600090815260386020908152848220868352815293902054169181019190915283518490849081106105ef576105ef611501565b60200260200101819052508160010191505b600101610572565b509095945050505050565b6001600160a01b038316600090815260346020526040902054839060ff1661065f576040516304fc6af960e21b81526001600160a01b03821660048201526024015b60405180910390fd5b6033546001600160a01b0316331461068a57604051633d74f23360e21b815260040160405180910390fd5b60005b828110156106fb5760008484838181106106a9576106a9611501565b6001600160a01b03808a16600090815260386020908152604080832094820296909601358083529390529390932054909350909116905080156106f1576106f1878383610fc7565b505060010161068d565b5050505050565b603354600160a01b900460ff161561072d5760405163473bc3c560e01b815260040160405180910390fd5b6001600160a01b038316600090815260346020526040902054839060ff16610773576040516304fc6af960e21b81526001600160a01b0382166004820152602401610656565b600260015414156107c65760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610656565b600260015560005b828110156108545760008484838181106107ea576107ea611501565b6001600160a01b038981166000908152603860209081526040808320948202969096013580835293905293909320549093509091163314905061084057604051632a29eae960e21b815260040160405180910390fd5b61084b868233610fc7565b506001016107ce565b50336001600160a01b03167f20748b935fd9f21155c2e98cb2bd5df6fe86f21b193cebaae8d9ad7db0ba54168484604051610890929190611481565b60405180910390a25050600180555050565b603660205281600052604060002081815481106108be57600080fd5b90600052602060002001600091509150505481565b6001600160a01b038216600090815260346020526040812054839060ff16610919576040516304fc6af960e21b81526001600160a01b0382166004820152602401610656565b6001600160a01b0384811660009081526038602090815260408083208784529091529020541661095c5760405163da70723f60e01b815260040160405180910390fd5b50506001600160a01b03918216600090815260386020908152604080832093835292905220541690565b6033546001600160a01b031633146109b157604051633d74f23360e21b815260040160405180910390fd5b6001600160a01b03831660009081526034602052604090205460ff166109da576109da83611071565b60015b81811015610a40578282600183038181106109fa576109fa611501565b90506020020135838383818110610a1357610a13611501565b9050602002013511610a385760405163b24aa19560e01b815260040160405180910390fd5b6001016109dd565b506001600160a01b0383166000908152603660205260409020610a64908383611130565b50505050565b600054610100900460ff1615808015610a8a5750600054600160ff909116105b80610aa45750303b158015610aa4575060005460ff166001145b610b075760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610656565b6000805460ff191660011790558015610b2a576000805461ff0019166101001790555b603380546001600160a81b0319166001600160a01b03841617600160a01b1790558015610b91576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050565b60606000610ba586868686610ed5565b90506000808267ffffffffffffffff811115610bc357610bc3611517565b604051908082528060200260200182016040528015610bec578160200160208202803683370190505b509050855b858111610c56576001600160a01b03898116600090815260386020908152604080832085845290915290205481169089161415610c4e5780828480600101955081518110610c4157610c41611501565b6020026020010181815250505b600101610bf1565b50979650505050505050565b603354600160a01b900460ff1615610c8d5760405163473bc3c560e01b815260040160405180910390fd5b6001600160a01b038316600090815260346020526040902054839060ff16610cd3576040516304fc6af960e21b81526001600160a01b0382166004820152602401610656565b60026001541415610d265760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610656565b60026001556001600160a01b03841660009081526035602052604090205460ff1615610d7057604051630101380b60e71b81526001600160a01b0385166004820152602401610656565b60005b82811015610e99576000848483818110610d8f57610d8f611501565b6001600160a01b03898116600090815260386020908152604080832094820296909601358083529390529390932054909350909116159050610de4576040516316e9ad8f60e01b815260040160405180910390fd5b6001600160a01b03861660008181526037602090815260408083208584528252808320429055838352603882528083208584529091529081902080546001600160a01b031916339081179091559051632142170760e11b81526004810191909152306024820152604481018390526342842e0e90606401600060405180830381600087803b158015610e7557600080fd5b505af1158015610e89573d6000803e3d6000fd5b5050505081600101915050610d73565b50336001600160a01b03167f134b166c6094cc1ccbf1e3353ce5c3cd9fd29869051bdb999895854d77cc5ef68484604051610890929190611481565b600080835b838111610f20576001600160a01b03878116600090815260386020908152604080832085845290915290205481169087161415610f18578160010191505b600101610eda565b5095945050505050565b6001600160a01b038216600090815260346020526040902054829060ff16610f70576040516304fc6af960e21b81526001600160a01b0382166004820152602401610656565b6033546001600160a01b03163314610f9b57604051633d74f23360e21b815260040160405180910390fd5b506001600160a01b03919091166000908152603560205260409020805460ff1916911515919091179055565b6001600160a01b0383811660008181526037602090815260408083208784528252808320839055838352603882528083208784529091529081902080546001600160a01b031916905551632142170760e11b8152306004820152918316602483015260448201849052906342842e0e90606401600060405180830381600087803b15801561105457600080fd5b505af1158015611068573d6000803e3d6000fd5b50505050505050565b6040516301ffc9a760e01b81526380ac58cd60e01b60048201526001600160a01b038216906301ffc9a79060240160206040518083038186803b1580156110b757600080fd5b505afa1580156110cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ef91906113e2565b61110c57604051632fda86bb60e21b815260040160405180910390fd5b6001600160a01b03166000908152603460205260409020805460ff19166001179055565b82805482825590600052602060002090810192821561116b579160200282015b8281111561116b578235825591602001919060010190611150565b5061117792915061117b565b5090565b5b80821115611177576000815560010161117c565b80356001600160a01b03811681146111a757600080fd5b919050565b6000602082840312156111be57600080fd5b6111c782611190565b9392505050565b6000806000806000608086880312156111e657600080fd5b6111ef86611190565b94506111fd60208701611190565b935060408601359250606086013567ffffffffffffffff8082111561122157600080fd5b818801915088601f83011261123557600080fd5b81358181111561124457600080fd5b89602082850101111561125657600080fd5b9699959850939650602001949392505050565b6000806000806080858703121561127f57600080fd5b61128885611190565b935061129660208601611190565b93969395505050506040820135916060013590565b6000806000604084860312156112c057600080fd5b6112c984611190565b9250602084013567ffffffffffffffff808211156112e657600080fd5b818601915086601f8301126112fa57600080fd5b81358181111561130957600080fd5b8760208260051b850101111561131e57600080fd5b6020830194508093505050509250925092565b6000806040838503121561134457600080fd5b61134d83611190565b9150602083013561135d8161152d565b809150509250929050565b6000806040838503121561137b57600080fd5b61138483611190565b946020939093013593505050565b6000806000606084860312156113a757600080fd5b6113b084611190565b95602085013595506040909401359392505050565b6000602082840312156113d757600080fd5b81356111c78161152d565b6000602082840312156113f457600080fd5b81516111c78161152d565b60006020828403121561141157600080fd5b81356001600160e01b0319811681146111c757600080fd5b602080825282518282018190526000919060409081850190868401855b82811015611474578151805185528601516001600160a01b0316868501529284019290850190600101611446565b5091979650505050505050565b6020808252810182905260006001600160fb1b038311156114a157600080fd5b8260051b80856040850137600092016040019182525092915050565b6020808252825182820181905260009190848201906040850190845b818110156114f5578351835292840192918401916001016114d9565b50909695505050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b801515811461153b57600080fd5b5056fea26469706673582212207a742513e4d933a966085680bd114ae7c88312b9dc87ff382040d22861e020f964736f6c63430008060033

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.