- Contract name:
- TimeTask
- Optimization enabled
- false
- Compiler version
- v0.8.24+commit.e11b9ed9
- Verified at
- 2024-09-04 03:00:40.256656Z
Constructor Arguments
000000000000000000000000c5dc8e0b0f537f95aea6c7477a8e1d8810d46543
Arg [0] (address) : 0xc5dc8e0b0f537f95aea6c7477a8e1d8810d46543
contracts/TimeTask.sol
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.24; import "@openzeppelin/contracts/access/Ownable.sol"; contract TimeTask is Ownable { uint private _currentTimestamp = block.timestamp; address private _updater; constructor(address updater) Ownable(msg.sender) { _updater = updater; } modifier onlyUpdater() { require(msg.sender == _updater, "caller is not the updater"); _; } function set(uint timestamp) external onlyUpdater { _currentTimestamp = timestamp; } function get() external view returns (uint) { return _currentTimestamp; } function setUpdater(address updater) external onlyOwner { require(updater != _updater, "can't update old updater"); _updater = updater; } function getUpdater() external view returns (address) { return _updater; } }
@openzeppelin/contracts/access/Ownable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {Context} from "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is set to the address provided by the deployer. 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; /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ constructor(address initialOwner) { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling 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 { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _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); } }
@openzeppelin/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; /** * @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; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"updater","internalType":"address"}]},{"type":"error","name":"OwnableInvalidOwner","inputs":[{"type":"address","name":"owner","internalType":"address"}]},{"type":"error","name":"OwnableUnauthorizedAccount","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"get","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getUpdater","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"set","inputs":[{"type":"uint256","name":"timestamp","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setUpdater","inputs":[{"type":"address","name":"updater","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]}]
Deployed ByteCode
0x608060405234801561001057600080fd5b506004361061007d5760003560e01c80638da5cb5b1161005b5780638da5cb5b146100c657806399d54d39146100e45780639d54f41914610102578063f2fde38b1461011e5761007d565b806360fe47b1146100825780636d4ce63c1461009e578063715018a6146100bc575b600080fd5b61009c60048036038101906100979190610535565b61013a565b005b6100a66101d4565b6040516100b39190610571565b60405180910390f35b6100c46101de565b005b6100ce6101f2565b6040516100db91906105cd565b60405180910390f35b6100ec61021b565b6040516100f991906105cd565b60405180910390f35b61011c60048036038101906101179190610614565b610245565b005b61013860048036038101906101339190610614565b610321565b005b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146101ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101c19061069e565b60405180910390fd5b8060018190555050565b6000600154905090565b6101e66103a7565b6101f0600061042e565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b61024d6103a7565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036102dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102d49061070a565b60405180910390fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6103296103a7565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361039b5760006040517f1e4fbdf700000000000000000000000000000000000000000000000000000000815260040161039291906105cd565b60405180910390fd5b6103a48161042e565b50565b6103af6104f2565b73ffffffffffffffffffffffffffffffffffffffff166103cd6101f2565b73ffffffffffffffffffffffffffffffffffffffff161461042c576103f06104f2565b6040517f118cdaa700000000000000000000000000000000000000000000000000000000815260040161042391906105cd565b60405180910390fd5b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600033905090565b600080fd5b6000819050919050565b610512816104ff565b811461051d57600080fd5b50565b60008135905061052f81610509565b92915050565b60006020828403121561054b5761054a6104fa565b5b600061055984828501610520565b91505092915050565b61056b816104ff565b82525050565b60006020820190506105866000830184610562565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006105b78261058c565b9050919050565b6105c7816105ac565b82525050565b60006020820190506105e260008301846105be565b92915050565b6105f1816105ac565b81146105fc57600080fd5b50565b60008135905061060e816105e8565b92915050565b60006020828403121561062a576106296104fa565b5b6000610638848285016105ff565b91505092915050565b600082825260208201905092915050565b7f63616c6c6572206973206e6f7420746865207570646174657200000000000000600082015250565b6000610688601983610641565b915061069382610652565b602082019050919050565b600060208201905081810360008301526106b78161067b565b9050919050565b7f63616e277420757064617465206f6c6420757064617465720000000000000000600082015250565b60006106f4601883610641565b91506106ff826106be565b602082019050919050565b60006020820190508181036000830152610723816106e7565b905091905056fea2646970667358221220b416f6376b2cedac1c3a88474c92c401adb1db226a4a63b64a1f38fb7f66012f64736f6c63430008180033