Contract 0x50c001e4eb10801968f6640e1537d63a557e5d72 1

 
 

Txn Hash
Method
Block
From
To
Value [Txn Fee]
Latest 1 internal transaction
Parent Txn Hash Block From To Value
0x3331965e51620c0a0769c3a1c4961eb3aef752997967b803ec99b10889f62830290402592022-06-01 16:47:26304 days 5 hrs ago 0x4e59b44847b379578588920ca78fbf26c0b4956c  Contract Creation0 MATIC
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
TimeCop

Compiler Version
v0.8.7+commit.e28d00a7

Optimization Enabled:
Yes with 800 runs

Other Settings:
default evmVersion, MIT license

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 3 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../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.
 *
 * 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 2 of 3 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

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

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

File 3 of 3 : TimeCop.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";

contract TimeCop {
    event TimeLimitSet(address collection, uint256 deadline);

    error InvalidTimeLimit(uint256 offsetSeconds);
    error NotCollectionOwner();
    error TimeLimitAlreadySet();

    uint256 public immutable MAX_DURATION_SECONDS;

    /// @notice the time limits expressed as a timestamp in seconds
    mapping(address => uint256) public timeLimits;

    /// @param _maxDurationSeconds maximum time limit
    /// @dev _maxDurationSeconds can be set to 0 to have no maximum time limit
    constructor(uint256 _maxDurationSeconds) {
        MAX_DURATION_SECONDS = _maxDurationSeconds;
    }

    /// @notice Sets the deadline for the given collection
    /// @notice Only the owner of the collection can set the deadline
    /// @param collection The address to set the deadline for
    /// @param offsetSeconds a duration in seconds that will be used to set the time limit
    function setTimeLimit(address collection, uint256 offsetSeconds) external {
        if (offsetSeconds == 0) {
            revert InvalidTimeLimit(offsetSeconds);
        }

        if (MAX_DURATION_SECONDS > 0 && offsetSeconds > MAX_DURATION_SECONDS) {
            revert InvalidTimeLimit(offsetSeconds);
        }

        if (timeLimitSet(collection)) {
            revert TimeLimitAlreadySet();
        }

        if (msg.sender != Ownable(collection).owner()) {
            revert NotCollectionOwner();
        }

        uint256 deadline = block.timestamp + offsetSeconds;
        timeLimits[collection] = deadline;

        emit TimeLimitSet(collection, deadline);
    }

    function timeLimitSet(address collection) public view returns (bool) {
        return timeLimits[collection] > 0;
    }

    /// @return false if there is no time limit set for that collection
    function timeLimitReached(address collection) public view returns (bool) {
        return timeLimitSet(collection) && block.timestamp > timeLimits[collection];
    }
}

Settings
{
  "evmVersion": "london",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "none",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 800
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"uint256","name":"_maxDurationSeconds","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"offsetSeconds","type":"uint256"}],"name":"InvalidTimeLimit","type":"error"},{"inputs":[],"name":"NotCollectionOwner","type":"error"},{"inputs":[],"name":"TimeLimitAlreadySet","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"collection","type":"address"},{"indexed":false,"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"TimeLimitSet","type":"event"},{"inputs":[],"name":"MAX_DURATION_SECONDS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"offsetSeconds","type":"uint256"}],"name":"setTimeLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"}],"name":"timeLimitReached","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"}],"name":"timeLimitSet","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"timeLimits","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

60a060405234801561001057600080fd5b5060405161047238038061047283398101604081905261002f91610037565b608052610050565b60006020828403121561004957600080fd5b5051919050565b6080516103fa6100786000396000818160f401528181610153015261017c01526103fa6000f3fe608060405234801561001057600080fd5b50600436106100675760003560e01c806399b491731161005057806399b49173146100c1578063b11d2758146100ef578063cf06dde41461011657600080fd5b806326d79f7c1461006c57806389f25e6214610081575b600080fd5b61007f61007a366004610383565b610129565b005b6100ac61008f366004610342565b6001600160a01b0316600090815260208190526040902054151590565b60405190151581526020015b60405180910390f35b6100e16100cf366004610342565b60006020819052908152604090205481565b6040519081526020016100b8565b6100e17f000000000000000000000000000000000000000000000000000000000000000081565b6100ac610124366004610342565b6102fe565b8061014f5760405163d7f6f2e960e01b8152600481018290526024015b60405180910390fd5b60007f000000000000000000000000000000000000000000000000000000000000000011801561019e57507f000000000000000000000000000000000000000000000000000000000000000081115b156101bf5760405163d7f6f2e960e01b815260048101829052602401610146565b6001600160a01b038216600090815260208190526040902054156101f657604051631c27a43960e21b815260040160405180910390fd5b816001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561022f57600080fd5b505afa158015610243573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102679190610366565b6001600160a01b0316336001600160a01b031614610298576040516327ecd79f60e11b815260040160405180910390fd5b60006102a482426103af565b6001600160a01b03841660008181526020818152604091829020849055815192835282018390529192507f776e7116fa43d9385f3fd667b2e34d792fd3eec4b5a0aa8d1758b877ab4d6cbe910160405180910390a1505050565b6001600160a01b0381166000908152602081905260408120541515801561033c57506001600160a01b03821660009081526020819052604090205442115b92915050565b60006020828403121561035457600080fd5b813561035f816103d5565b9392505050565b60006020828403121561037857600080fd5b815161035f816103d5565b6000806040838503121561039657600080fd5b82356103a1816103d5565b946020939093013593505050565b600082198211156103d057634e487b7160e01b600052601160045260246000fd5b500190565b6001600160a01b03811681146103ea57600080fd5b5056fea164736f6c6343000807000a000000000000000000000000000000000000000000000000000000000028de80

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

000000000000000000000000000000000000000000000000000000000028de80

-----Decoded View---------------
Arg [0] : _maxDurationSeconds (uint256): 2678400

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000000000000000000000000000000000000028de80


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.