Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0x60d4a9CB8aDCE7Ae0a8d4F110D31ee6F5e56e996
Balance 0 ETH
Nonce 1
Code Size 4443 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

4443 bytes
0x608060405234801561001057600080fd5b50600436106101005760003560e01c80638da5cb5b11610097578063d9ffad4711610066578063d9ffad47146102a1578063e0639364146102b4578063e18ea393146102bd578063f2fde38b146102dd57600080fd5b80638da5cb5b146101f2578063a5cd761f14610210578063cd24b0a314610246578063d92656a71461027c57600080fd5b80636691b0fe116100d35780636691b0fe14610153578063715018a614610193578063779972da1461019b57806383c13db2146101ae57600080fd5b806304333f29146101055780632aa645341461012e5780633b8105b31461013857806348aa193614610140575b600080fd5b610118610113366004610e40565b6102f0565b6040516101259190610f7d565b60405180910390f35b610136610369565b005b61013661043d565b61013661014e366004610e81565b61050b565b61016e73c7b76846de3db54db45c8b5debcabff4b0834f7881565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610125565b61013661077d565b6101366101a9366004610f64565b61080a565b6101e46101bc366004610e40565b73ffffffffffffffffffffffffffffffffffffffff1660009081526003602052604090205490565b604051908152602001610125565b60005473ffffffffffffffffffffffffffffffffffffffff1661016e565b61016e61021e366004610f64565b60009081526002602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b60005461026c907501000000000000000000000000000000000000000000900460ff1681565b6040519015158152602001610125565b60005461026c9074010000000000000000000000000000000000000000900460ff1681565b6101366102af366004610e81565b6108c4565b6101e460015481565b6101e46102cb366004610f64565b60009081526004602052604090205490565b6101366102eb366004610e40565b610bd6565b73ffffffffffffffffffffffffffffffffffffffff811660009081526003602090815260409182902080548351818402810184019094528084526060939283018282801561035d57602002820191906000526020600020905b815481526020019060010190808311610349575b50505050509050919050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146103ef576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b600080547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff811675010000000000000000000000000000000000000000009182900460ff1615909102179055565b60005473ffffffffffffffffffffffffffffffffffffffff1633146104be576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103e6565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff8116740100000000000000000000000000000000000000009182900460ff1615909102179055565b60005b815181101561077957600082828151811061052b5761052b6110a5565b6020908102919091018101516000818152600290925260409091205490915073ffffffffffffffffffffffffffffffffffffffff1633146105ed576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f596f7520617265206e6f7420746865206f776e6572206f66207468697320746f60448201527f6b656e210000000000000000000000000000000000000000000000000000000060648201526084016103e6565b60008181526004602052604090205442118061062957506000547501000000000000000000000000000000000000000000900460ff1615156001145b61068f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f546f6b656e206973207374696c6c206c6f636b6564000000000000000000000060448201526064016103e6565b6040517f23b872dd0000000000000000000000000000000000000000000000000000000081523060048201523360248201526044810182905273c7b76846de3db54db45c8b5debcabff4b0834f78906323b872dd90606401600060405180830381600087803b15801561070157600080fd5b505af1158015610715573d6000803e3d6000fd5b50503360009081526003602052604090206107339250905082610d06565b600090815260026020526040902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055806107718161100e565b91505061050e565b5050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146107fe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103e6565b6108086000610dcb565b565b60005473ffffffffffffffffffffffffffffffffffffffff16331461088b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103e6565b6001805490829055604051829082907f215ad44af04f93b13eb61772a293ca5bf60435095285cf459417ae102dde988b90600090a35050565b60005474010000000000000000000000000000000000000000900460ff16610948576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5374616b696e67206e6f74206c6976652079657400000000000000000000000060448201526064016103e6565b60005b8151811015610779576000828281518110610968576109686110a5565b60209081029190910101516040517f6352211e00000000000000000000000000000000000000000000000000000000815260048101829052909150339073c7b76846de3db54db45c8b5debcabff4b0834f7890636352211e9060240160206040518083038186803b1580156109dc57600080fd5b505afa1580156109f0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a149190610e64565b73ffffffffffffffffffffffffffffffffffffffff16148015610a59575060008181526002602052604090205473ffffffffffffffffffffffffffffffffffffffff16155b610abf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f596f7520646f206e6f74206f776e2074686520746f6b656e210000000000000060448201526064016103e6565b6040517f23b872dd0000000000000000000000000000000000000000000000000000000081523360048201523060248201526044810182905273c7b76846de3db54db45c8b5debcabff4b0834f78906323b872dd90606401600060405180830381600087803b158015610b3157600080fd5b505af1158015610b45573d6000803e3d6000fd5b5050336000818152600360209081526040808320805460018181018355918552838520018890558784526002909252822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169093179092559054909250610bb0915042610fc1565b600092835260046020526040909220919091555080610bce8161100e565b91505061094b565b60005473ffffffffffffffffffffffffffffffffffffffff163314610c57576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103e6565b73ffffffffffffffffffffffffffffffffffffffff8116610cfa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016103e6565b610d0381610dcb565b50565b815460005b81811015610dc55782848281548110610d2657610d266110a5565b90600052602060002001541415610db35781610d4181610fd9565b92505081811015610d8857838281548110610d5e57610d5e6110a5565b9060005260206000200154848281548110610d7b57610d7b6110a5565b6000918252602090912001555b83805480610d9857610d98611076565b60019003818190600052602060002001600090559055610dc5565b80610dbd8161100e565b915050610d0b565b50505050565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060208284031215610e5257600080fd5b8135610e5d81611103565b9392505050565b600060208284031215610e7657600080fd5b8151610e5d81611103565b60006020808385031215610e9457600080fd5b823567ffffffffffffffff80821115610eac57600080fd5b818501915085601f830112610ec057600080fd5b813581811115610ed257610ed26110d4565b8060051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f83011681018181108582111715610f1557610f156110d4565b604052828152858101935084860182860187018a1015610f3457600080fd5b600095505b83861015610f57578035855260019590950194938601938601610f39565b5098975050505050505050565b600060208284031215610f7657600080fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b81811015610fb557835183529284019291840191600101610f99565b50909695505050505050565b60008219821115610fd457610fd4611047565b500190565b600081610fe857610fe8611047565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561104057611040611047565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff81168114610d0357600080fdfea26469706673582212206fbff4e1d4f74461db015027ef4572d3aa98722d3c2313df89d65dcffdb9d9ef64736f6c63430008070033

Verified Source Code Partial Match

Compiler: v0.8.7+commit.e28d00a7 EVM: london Optimization: Yes (10000 runs)
CBCStaking.sol 383 lines
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol


// 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: @openzeppelin/contracts/token/ERC721/IERC721.sol


// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;


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

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

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

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

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

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

// File: @openzeppelin/contracts/utils/Context.sol


// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

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

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

// File: @openzeppelin/contracts/access/Ownable.sol


// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;


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

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

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

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

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

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

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

// File: ChillBearStaking.sol


pragma solidity ^0.8.7;



contract CBCStaking is Ownable {

    address public constant CBC_ADDRESS = 0xc7b76846De3DB54DB45c8b5deBCabfF4b0834F78;
    bool public stakingLive = false;
    bool public unlockAll = false;
    uint256 public stakingLockPeriod = 2592000;  // 30 days in seconds

    mapping(uint256 => address) internal tokenIdToAddress;
    mapping(address => uint256[]) internal addressToTokenIds;
    mapping(uint256 => uint256) internal tokenLockedUntil;

    event LockPeriodChanged(uint indexed prevLockPeriod, uint indexed newLockPeriod);
    
   
    IERC721 private constant _IERC721 = IERC721(CBC_ADDRESS);

    constructor() {
    }

    modifier stakingEnabled {
        require(stakingLive, "Staking not live yet");
        _;
    }

    function getCBCStaked(address staker) public view returns (uint256[] memory) {
        return addressToTokenIds[staker];
    }
    
    function getStakedCount(address staker) public view returns (uint256) {
        return addressToTokenIds[staker].length;
    }

    function removeTokenIdFromArray(uint256[] storage array, uint256 tokenId) internal {
        uint256 length = array.length;
        for (uint256 i = 0; i < length; i++) {
            if (array[i] == tokenId) {
                length--;
                if (i < length) {
                    array[i] = array[length];
                }
                array.pop();
                break;
            }
        }
    }

    function stakeByIds(uint256[] memory tokenIds) public stakingEnabled {

        for (uint256 i = 0; i < tokenIds.length; i++) {
            uint256 id = tokenIds[i];
            require(_IERC721.ownerOf(id) == msg.sender && tokenIdToAddress[id] == address(0), "You do not own the token!");
            _IERC721.transferFrom(msg.sender, address(this), id);

            addressToTokenIds[msg.sender].push(id);
            tokenIdToAddress[id] = msg.sender;
            
            uint256 lockUntil = block.timestamp + stakingLockPeriod;
            tokenLockedUntil[id] = lockUntil;
        }
    }

    function unstakeByIds(uint256[] memory tokenIds) public {

        for (uint256 i = 0; i < tokenIds.length; i++) {
            uint256 id = tokenIds[i];
            require(tokenIdToAddress[id] == msg.sender, "You are not the owner of this token!");
            require(tokenLockedUntil[id] < block.timestamp || unlockAll == true, "Token is still locked");

            _IERC721.transferFrom(address(this), msg.sender, id);

            removeTokenIdFromArray(addressToTokenIds[msg.sender], id);
            tokenIdToAddress[id] = address(0);
        }
    }


    function getTokenOwner(uint256 tokenId) public view returns (address) {
        return tokenIdToAddress[tokenId];
    }

    function getLockedUntil(uint256 tokenId) public view returns (uint256) {
        return tokenLockedUntil[tokenId];
    }

    function toggleStaking() external onlyOwner {
        stakingLive = !stakingLive;
    }

    function toggleUnlockAll() external onlyOwner {
        unlockAll = !unlockAll;
    }

    function setLockPeriod(uint newLockPeriod) external onlyOwner {
        uint prevLockPeriod = stakingLockPeriod;
        stakingLockPeriod = newLockPeriod;
        emit LockPeriodChanged(prevLockPeriod, newLockPeriod);
    }
}

Read Contract

CBC_ADDRESS 0x6691b0fe → address
getCBCStaked 0x04333f29 → uint256[]
getLockedUntil 0xe18ea393 → uint256
getStakedCount 0x83c13db2 → uint256
getTokenOwner 0xa5cd761f → address
owner 0x8da5cb5b → address
stakingLive 0xd92656a7 → bool
stakingLockPeriod 0xe0639364 → uint256
unlockAll 0xcd24b0a3 → bool

Write Contract 7 functions

These functions modify contract state and require a wallet transaction to execute.

renounceOwnership 0x715018a6
No parameters
setLockPeriod 0x779972da
uint256 newLockPeriod
stakeByIds 0xd9ffad47
uint256[] tokenIds
toggleStaking 0x3b8105b3
No parameters
toggleUnlockAll 0x2aa64534
No parameters
transferOwnership 0xf2fde38b
address newOwner
unstakeByIds 0x48aa1936
uint256[] tokenIds

Recent Transactions

No transactions found for this address