MATIC Price: $0.728796 (-2.64%)
Gas: 30 GWei
 

Overview

MATIC Balance

Polygon PoS Chain LogoPolygon PoS Chain LogoPolygon PoS Chain Logo0 MATIC

MATIC Value

$0.00

Token Holdings

Sponsored

Transaction Hash
Method
Block
From
To
Value
0xe16e54590041d9d6147255f0f74b89a0623a7287f35b38dee1ee1e765b3e9ab8-(pending)2024-05-28 17:08:274 secs ago1716916107IN
0x7308e295...89576923B
0 MATIC(Pending)(Pending)
0xcbb280da6e08459838ca389cd0ea4dafcbce49891d7f1aef7a0ca65aeb44680f-(pending)2024-05-28 17:08:274 secs ago1716916107IN
0x7308e295...89576923B
0 MATIC(Pending)(Pending)
0xe41fec8de8fd651271f0cc2db736d97ca120ef69ffce885a8c684758aa5e8801-(pending)2024-05-28 17:08:274 secs ago1716916107IN
0x7308e295...89576923B
0 MATIC(Pending)(Pending)
Insert Coin574963752024-05-28 17:08:0328 secs ago1716916083IN
0x7308e295...89576923B
0 MATIC0.0023992244.67
Insert Coin574963742024-05-28 17:08:0130 secs ago1716916081IN
0x7308e295...89576923B
0 MATIC0.0023992244.67
Insert Coin574963732024-05-28 17:07:5932 secs ago1716916079IN
0x7308e295...89576923B
0 MATIC0.0016113330.00065287
Insert Coin574963712024-05-28 17:07:5437 secs ago1716916074IN
0x7308e295...89576923B
0 MATIC0.0016113330.00065616
Insert Coin574963712024-05-28 17:07:5437 secs ago1716916074IN
0x7308e295...89576923B
0 MATIC0.0016113330.00065616
Insert Coin574963712024-05-28 17:07:5437 secs ago1716916074IN
0x7308e295...89576923B
0 MATIC0.0016113330.00065616
Insert Coin574963692024-05-28 17:07:5041 secs ago1716916070IN
0x7308e295...89576923B
0 MATIC0.0016113330.00064692
Insert Coin574963682024-05-28 17:07:4843 secs ago1716916068IN
0x7308e295...89576923B
0 MATIC0.0016116930.00060889
Insert Coin574963672024-05-28 17:07:4447 secs ago1716916064IN
0x7308e295...89576923B
0 MATIC0.0016116930.0006183
Insert Coin574963672024-05-28 17:07:4447 secs ago1716916064IN
0x7308e295...89576923B
0 MATIC0.002372444.1706183
Insert Coin574963662024-05-28 17:07:4249 secs ago1716916062IN
0x7308e295...89576923B
0 MATIC0.0023992244.67
Insert Coin574963642024-05-28 17:07:3853 secs ago1716916058IN
0x7308e295...89576923B
0 MATIC0.0016113330.00063904
Insert Coin574963642024-05-28 17:07:3853 secs ago1716916058IN
0x7308e295...89576923B
0 MATIC0.0016113330.00063904
Insert Coin574963642024-05-28 17:07:3853 secs ago1716916058IN
0x7308e295...89576923B
0 MATIC0.0016113330.00063904
Insert Coin574963642024-05-28 17:07:3853 secs ago1716916058IN
0x7308e295...89576923B
0 MATIC0.0016113330.00063904
Insert Coin574963642024-05-28 17:07:3853 secs ago1716916058IN
0x7308e295...89576923B
0 MATIC0.0016113330.00063904
Insert Coin574963632024-05-28 17:07:3655 secs ago1716916056IN
0x7308e295...89576923B
0 MATIC0.0016113330.00063649
Insert Coin574963622024-05-28 17:07:3457 secs ago1716916054IN
0x7308e295...89576923B
0 MATIC0.0016113330.00064519
Insert Coin574963622024-05-28 17:07:3457 secs ago1716916054IN
0x7308e295...89576923B
0 MATIC0.0016113330.00064519
Insert Coin574963622024-05-28 17:07:3457 secs ago1716916054IN
0x7308e295...89576923B
0 MATIC0.002372444.17064519
Insert Coin574963612024-05-28 17:07:321 mins ago1716916052IN
0x7308e295...89576923B
0 MATIC0.0016113330.00066488
Insert Coin574963602024-05-28 17:07:301 min ago1716916050IN
0x7308e295...89576923B
0 MATIC0.0016113330.00065662
View all transactions

Parent Transaction Hash Block From To Value
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
IxMinigame

Compiler Version
v0.8.23+commit.f704f362

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 4 : IxMinigame.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.23;

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

import {DateTime} from "./libs/DateTime.sol";

contract IxMinigame is Ownable {
    event GameResult(
        string gameType,
        string uid,
        address sender,
        uint256 timestamp,
        uint256 date,
        uint256 playCount,
        bytes32 result
    );
    event MaxPlayCountChanged(string gameType, uint256 limitBefore, uint256 limitAfter, address sender);
    event ContractSeedChanged(uint256 seedBefore, uint256 seedAfter, address sender);

    mapping(string => uint256) public maxAllowedPlays;

    uint256 public contractSeed;

    mapping(string => mapping(string => mapping(uint256 => uint256))) public user;
    mapping(string => mapping(address => mapping(uint256 => uint256))) public sender;

    constructor(address _owner, uint256 _contractSeed) {
        transferOwnership(_owner);
        emit ContractSeedChanged(contractSeed, _contractSeed, msg.sender);
        contractSeed = _contractSeed;
    }

    modifier onlyAllowedGame(string memory gameType) {
        require(maxAllowedPlays[gameType] > 0, "game not allowed");
        _;
    }

    function setMaxPlayCount(string memory gameType, uint256 _maxPlayCount) public onlyOwner {
        emit MaxPlayCountChanged(gameType, maxAllowedPlays[gameType], _maxPlayCount, msg.sender);
        maxAllowedPlays[gameType] = _maxPlayCount;
    }

    function setContractSeed(uint256 _contractSeed) public onlyOwner {
        emit ContractSeedChanged(contractSeed, _contractSeed, msg.sender);
        contractSeed = _contractSeed;
    }

    function insertCoin(string memory gameType, string memory uid) public onlyAllowedGame(gameType) {
        uint256 date;
        {
            (uint256 year, uint256 month, uint256 day) = DateTime.timestampToDate(block.timestamp);

            date = year * 10000 + month * 100 + day;
        }

        require(user[gameType][uid][date] < maxAllowedPlays[gameType], "user play limit exceeded");
        require(sender[gameType][msg.sender][date] < maxAllowedPlays[gameType], "sender play limit exceeded");

        bytes32 result = keccak256(abi.encodePacked(contractSeed, blockhash(block.number - 1), block.coinbase));

        user[gameType][uid][date] += 1;
        sender[gameType][msg.sender][date] += 1;
        contractSeed = uint256(result);

        emit GameResult(gameType, uid, msg.sender, block.timestamp, date, user[gameType][uid][date], result);
    }
}

File 2 of 4 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (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 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 {
        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 4 : 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 2 of 4 : DateTime.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.23;

// ----------------------------------------------------------------------------
// BokkyPooBah's DateTime Library v1.01
//
// A gas-efficient Solidity date and time library
//
// https://github.com/bokkypoobah/BokkyPooBahsDateTimeLibrary
//
// Tested date range 1970/01/01 to 2345/12/31
//
// Conventions:
// Unit      | Range         | Notes
// :-------- |:-------------:|:-----
// timestamp | >= 0          | Unix timestamp, number of seconds since 1970/01/01 00:00:00 UTC
// year      | 1970 ... 2345 |
// month     | 1 ... 12      |
// day       | 1 ... 31      |
// hour      | 0 ... 23      |
// minute    | 0 ... 59      |
// second    | 0 ... 59      |
// dayOfWeek | 1 ... 7       | 1 = Monday, ..., 7 = Sunday
//
//
// Enjoy. (c) BokkyPooBah / Bok Consulting Pty Ltd 2018-2019. The MIT Licence.
// ----------------------------------------------------------------------------

library DateTime {
    uint256 constant public SECONDS_PER_DAY = 24 * 60 * 60;
    uint256 constant public SECONDS_PER_HOUR = 60 * 60;
    uint256 constant public SECONDS_PER_MINUTE = 60;
    int256 constant public OFFSET19700101 = 2440588;

    uint256 constant public DOW_MON = 1;
    uint256 constant public DOW_TUE = 2;
    uint256 constant public DOW_WED = 3;
    uint256 constant public DOW_THU = 4;
    uint256 constant public DOW_FRI = 5;
    uint256 constant public DOW_SAT = 6;
    uint256 constant public DOW_SUN = 7;

    // ------------------------------------------------------------------------
    // Calculate the number of days from 1970/01/01 to year/month/day using
    // the date conversion algorithm from
    //   https://aa.usno.navy.mil/faq/JD_formula.html
    // and subtracting the offset 2440588 so that 1970/01/01 is day 0
    //
    // days = day
    //      - 32075
    //      + 1461 * (year + 4800 + (month - 14) / 12) / 4
    //      + 367 * (month - 2 - (month - 14) / 12 * 12) / 12
    //      - 3 * ((year + 4900 + (month - 14) / 12) / 100) / 4
    //      - offset
    // ------------------------------------------------------------------------
    function _daysFromDate(uint256 year, uint256 month, uint256 day) internal pure returns (uint256 _days) {
        require(year >= 1970, "year must be greater then 1970");
        int256 _year = int256(year);
        int256 _month = int256(month);
        int256 _day = int256(day);

        int256 __days = _day -
            32075 +
            (1461 * (_year + 4800 + (_month - 14) / 12)) /
            4 +
            (367 * (_month - 2 - ((_month - 14) / 12) * 12)) /
            12 -
            (3 * ((_year + 4900 + (_month - 14) / 12) / 100)) /
            4 -
            OFFSET19700101;

        _days = uint256(__days);
    }

    // ------------------------------------------------------------------------
    // Calculate year/month/day from the number of days since 1970/01/01 using
    // the date conversion algorithm from
    //   http://aa.usno.navy.mil/faq/docs/JD_Formula.php
    // and adding the offset 2440588 so that 1970/01/01 is day 0
    //
    // int256 L = days + 68569 + offset
    // int256 N = 4 * L / 146097
    // L = L - (146097 * N + 3) / 4
    // year = 4000 * (L + 1) / 1461001
    // L = L - 1461 * year / 4 + 31
    // month = 80 * L / 2447
    // dd = L - 2447 * month / 80
    // L = month / 11
    // month = month + 2 - 12 * L
    // year = 100 * (N - 49) + year + L
    // ------------------------------------------------------------------------
    function _daysToDate(uint256 _days)  internal pure returns (uint256 year, uint256 month, uint256 day) {
        int256 __days = int256(_days);

        // solhint-disable-next-line var-name-mixedcase
        int256 L = __days + 68569 + OFFSET19700101;
        // solhint-disable-next-line var-name-mixedcase
        int256 N = (4 * L) / 146097;
        L = L - (146097 * N + 3) / 4;
        int256 _year = (4000 * (L + 1)) / 1461001;
        L = L - (1461 * _year) / 4 + 31;
        int256 _month = (80 * L) / 2447;
        int256 _day = L - (2447 * _month) / 80;
        L = _month / 11;
        _month = _month + 2 - 12 * L;
        _year = 100 * (N - 49) + _year + L;

        year = uint256(_year);
        month = uint256(_month);
        day = uint256(_day);
    }

    function timestampFromDate(uint256 year, uint256 month, uint256 day) internal pure returns (uint256 timestamp) {
        timestamp = _daysFromDate(year, month, day) * SECONDS_PER_DAY;
    }

    function timestampFromDateTime(
        uint256 year,
        uint256 month,
        uint256 day,
        uint256 hour,
        uint256 minute,
        uint256 second
    ) internal pure returns (uint256 timestamp) {
        timestamp =
            _daysFromDate(year, month, day) *
            SECONDS_PER_DAY +
            hour *
            SECONDS_PER_HOUR +
            minute *
            SECONDS_PER_MINUTE +
            second;
    }

    function timestampToDate(uint256 timestamp) internal pure returns (uint256 year, uint256 month, uint256 day) {
        (year, month, day) = _daysToDate(timestamp / SECONDS_PER_DAY);
    }

    function timestampToDateTime(
        uint256 timestamp
    ) internal pure returns (uint256 year, uint256 month, uint256 day, uint256 hour, uint256 minute, uint256 second) {
        (year, month, day) = _daysToDate(timestamp / SECONDS_PER_DAY);
        uint256 secs = timestamp % SECONDS_PER_DAY;
        hour = secs / SECONDS_PER_HOUR;
        secs = secs % SECONDS_PER_HOUR;
        minute = secs / SECONDS_PER_MINUTE;
        second = secs % SECONDS_PER_MINUTE;
    }

    function isValidDate(uint256 year, uint256 month, uint256 day) internal pure returns (bool valid) {
        if (year >= 1970 && month > 0 && month <= 12) {
            uint256 daysInMonth = _getDaysInMonth(year, month);
            if (day > 0 && day <= daysInMonth) {
                valid = true;
            }
        }
    }

    function isValidDateTime(
        uint256 year,
        uint256 month,
        uint256 day,
        uint256 hour,
        uint256 minute,
        uint256 second
    ) internal pure returns (bool valid) {
        if (isValidDate(year, month, day)) {
            if (hour < 24 && minute < 60 && second < 60) {
                valid = true;
            }
        }
    }

    function isLeapYear(uint256 timestamp) internal pure returns (bool leapYear) {
        (uint256 year, , ) = _daysToDate(timestamp / SECONDS_PER_DAY);
        leapYear = _isLeapYear(year);
    }

    function _isLeapYear(uint256 year) internal pure returns (bool leapYear) {
        leapYear = ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0);
    }

    function isWeekDay(uint256 timestamp) internal pure returns (bool weekDay) {
        weekDay = getDayOfWeek(timestamp) <= DOW_FRI;
    }

    function isWeekEnd(uint256 timestamp) internal pure returns (bool weekEnd) {
        weekEnd = getDayOfWeek(timestamp) >= DOW_SAT;
    }

    function getDaysInMonth(uint256 timestamp) internal pure returns (uint256 daysInMonth) {
        (uint256 year, uint256 month, ) = _daysToDate(timestamp / SECONDS_PER_DAY);
        daysInMonth = _getDaysInMonth(year, month);
    }

    function _getDaysInMonth(uint256 year, uint256 month) internal pure returns (uint256 daysInMonth) {
        if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) {
            daysInMonth = 31;
        } else if (month != 2) {
            daysInMonth = 30;
        } else {
            daysInMonth = _isLeapYear(year) ? 29 : 28;
        }
    }

    // 1 = Monday, 7 = Sunday
    function getDayOfWeek(uint256 timestamp) internal pure returns (uint256 dayOfWeek) {
        uint256 _days = timestamp / SECONDS_PER_DAY;
        dayOfWeek = ((_days + 3) % 7) + 1;
    }

    function getYear(uint256 timestamp) internal pure returns (uint256 year) {
        (year, , ) = _daysToDate(timestamp / SECONDS_PER_DAY);
    }

    function getMonth(uint256 timestamp) internal pure returns (uint256 month) {
        (, month, ) = _daysToDate(timestamp / SECONDS_PER_DAY);
    }

    function getDay(uint256 timestamp) internal pure returns (uint256 day) {
        (, , day) = _daysToDate(timestamp / SECONDS_PER_DAY);
    }

    function getHour(uint256 timestamp) internal pure returns (uint256 hour) {
        uint256 secs = timestamp % SECONDS_PER_DAY;
        hour = secs / SECONDS_PER_HOUR;
    }

    function getMinute(uint256 timestamp) internal pure returns (uint256 minute) {
        uint256 secs = timestamp % SECONDS_PER_HOUR;
        minute = secs / SECONDS_PER_MINUTE;
    }

    function getSecond(uint256 timestamp) internal pure returns (uint256 second) {
        second = timestamp % SECONDS_PER_MINUTE;
    }

    function addYears(uint256 timestamp, uint256 _years) internal pure returns (uint256 newTimestamp) {
        (uint256 year, uint256 month, uint256 day) = _daysToDate(timestamp / SECONDS_PER_DAY);
        year += _years;
        uint256 daysInMonth = _getDaysInMonth(year, month);
        if (day > daysInMonth) {
            day = daysInMonth;
        }
        newTimestamp = _daysFromDate(year, month, day) * SECONDS_PER_DAY + (timestamp % SECONDS_PER_DAY);
        require(newTimestamp >= timestamp, "new timestamp must be after the given timestamp");
    }

    function addMonths(uint256 timestamp, uint256 _months) internal pure returns (uint256 newTimestamp) {
        (uint256 year, uint256 month, uint256 day) = _daysToDate(timestamp / SECONDS_PER_DAY);
        month += _months;
        year += (month - 1) / 12;
        month = ((month - 1) % 12) + 1;
        uint256 daysInMonth = _getDaysInMonth(year, month);
        if (day > daysInMonth) {
            day = daysInMonth;
        }
        newTimestamp = _daysFromDate(year, month, day) * SECONDS_PER_DAY + (timestamp % SECONDS_PER_DAY);
        require(newTimestamp >= timestamp, "new timestamp must be after the given timestamp");
    }

    function addDays(uint256 timestamp, uint256 _days) internal pure returns (uint256 newTimestamp) {
        newTimestamp = timestamp + _days * SECONDS_PER_DAY;
        require(newTimestamp >= timestamp, "new timestamp must be after the given timestamp");
    }

    function addHours(uint256 timestamp, uint256 _hours) internal pure returns (uint256 newTimestamp) {
        newTimestamp = timestamp + _hours * SECONDS_PER_HOUR;
        require(newTimestamp >= timestamp, "new timestamp must be after the given timestamp");
    }

    function addMinutes(uint256 timestamp, uint256 _minutes) internal pure returns (uint256 newTimestamp) {
        newTimestamp = timestamp + _minutes * SECONDS_PER_MINUTE;
        require(newTimestamp >= timestamp, "new timestamp must be after the given timestamp");
    }

    function addSeconds(uint256 timestamp, uint256 _seconds) internal pure returns (uint256 newTimestamp) {
        newTimestamp = timestamp + _seconds;
        require(newTimestamp >= timestamp, "new timestamp must be after the given timestamp");
    }

    function subYears(uint256 timestamp, uint256 _years) internal pure returns (uint256 newTimestamp) {
        (uint256 year, uint256 month, uint256 day) = _daysToDate(timestamp / SECONDS_PER_DAY);
        year -= _years;
        uint256 daysInMonth = _getDaysInMonth(year, month);
        if (day > daysInMonth) {
            day = daysInMonth;
        }
        newTimestamp = _daysFromDate(year, month, day) * SECONDS_PER_DAY + (timestamp % SECONDS_PER_DAY);
        require(newTimestamp <= timestamp, "new timestamp must be before the given timestamp");
    }

    function subMonths(uint256 timestamp, uint256 _months) internal pure returns (uint256 newTimestamp) {
        (uint256 year, uint256 month, uint256 day) = _daysToDate(timestamp / SECONDS_PER_DAY);
        uint256 yearMonth = year * 12 + (month - 1) - _months;
        year = yearMonth / 12;
        month = (yearMonth % 12) + 1;
        uint256 daysInMonth = _getDaysInMonth(year, month);
        if (day > daysInMonth) {
            day = daysInMonth;
        }
        newTimestamp = _daysFromDate(year, month, day) * SECONDS_PER_DAY + (timestamp % SECONDS_PER_DAY);
        require(newTimestamp <= timestamp, "new timestamp must be before the given timestamp");
    }

    function subDays(uint256 timestamp, uint256 _days) internal pure returns (uint256 newTimestamp) {
        newTimestamp = timestamp - _days * SECONDS_PER_DAY;
        require(newTimestamp <= timestamp, "new timestamp must be before the given timestamp");
    }

    function subHours(uint256 timestamp, uint256 _hours) internal pure returns (uint256 newTimestamp) {
        newTimestamp = timestamp - _hours * SECONDS_PER_HOUR;
        require(newTimestamp <= timestamp, "new timestamp must be before the given timestamp");
    }

    function subMinutes(uint256 timestamp, uint256 _minutes) internal pure returns (uint256 newTimestamp) {
        newTimestamp = timestamp - _minutes * SECONDS_PER_MINUTE;
        require(newTimestamp <= timestamp, "new timestamp must be before the given timestamp");
    }

    function subSeconds(uint256 timestamp, uint256 _seconds) internal pure returns (uint256 newTimestamp) {
        newTimestamp = timestamp - _seconds;
        require(newTimestamp <= timestamp, "new timestamp must be before the given timestamp");
    }

    function diffYears(uint256 fromTimestamp, uint256 toTimestamp) internal pure returns (uint256 _years) {
        require(fromTimestamp <= toTimestamp, "fromTimestamp must be before toTimestamp");
        (uint256 fromYear, , ) = _daysToDate(fromTimestamp / SECONDS_PER_DAY);
        (uint256 toYear, , ) = _daysToDate(toTimestamp / SECONDS_PER_DAY);
        _years = toYear - fromYear;
    }

    function diffMonths(uint256 fromTimestamp, uint256 toTimestamp) internal pure returns (uint256 _months) {
        require(fromTimestamp <= toTimestamp, "fromTimestamp must be before toTimestamp");
        (uint256 fromYear, uint256 fromMonth, ) = _daysToDate(fromTimestamp / SECONDS_PER_DAY);
        (uint256 toYear, uint256 toMonth, ) = _daysToDate(toTimestamp / SECONDS_PER_DAY);
        _months = toYear * 12 + toMonth - fromYear * 12 - fromMonth;
    }

    function diffDays(uint256 fromTimestamp, uint256 toTimestamp) internal pure returns (uint256 _days) {
        require(fromTimestamp <= toTimestamp, "fromTimestamp must be before toTimestamp");
        _days = (toTimestamp - fromTimestamp) / SECONDS_PER_DAY;
    }

    function diffHours(uint256 fromTimestamp, uint256 toTimestamp) internal pure returns (uint256 _hours) {
        require(fromTimestamp <= toTimestamp, "fromTimestamp must be before toTimestamp");
        _hours = (toTimestamp - fromTimestamp) / SECONDS_PER_HOUR;
    }

    function diffMinutes(uint256 fromTimestamp, uint256 toTimestamp) internal pure returns (uint256 _minutes) {
        require(fromTimestamp <= toTimestamp, "fromTimestamp must be before toTimestamp");
        _minutes = (toTimestamp - fromTimestamp) / SECONDS_PER_MINUTE;
    }

    function diffSeconds(uint256 fromTimestamp, uint256 toTimestamp) internal pure returns (uint256 _seconds) {
        require(fromTimestamp <= toTimestamp, "fromTimestamp must be before toTimestamp");
        _seconds = toTimestamp - fromTimestamp;
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"uint256","name":"_contractSeed","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"seedBefore","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"seedAfter","type":"uint256"},{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"ContractSeedChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"gameType","type":"string"},{"indexed":false,"internalType":"string","name":"uid","type":"string"},{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"date","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"playCount","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"result","type":"bytes32"}],"name":"GameResult","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"gameType","type":"string"},{"indexed":false,"internalType":"uint256","name":"limitBefore","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"limitAfter","type":"uint256"},{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"MaxPlayCountChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"contractSeed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"gameType","type":"string"},{"internalType":"string","name":"uid","type":"string"}],"name":"insertCoin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"","type":"string"}],"name":"maxAllowedPlays","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"","type":"string"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"sender","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_contractSeed","type":"uint256"}],"name":"setContractSeed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"gameType","type":"string"},{"internalType":"uint256","name":"_maxPlayCount","type":"uint256"}],"name":"setMaxPlayCount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"","type":"string"},{"internalType":"string","name":"","type":"string"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"user","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b506040516200104938038062001049833981016040819052610031916101b7565b61003a3361008d565b610043826100dd565b60025460408051918252602082018390523382820152517ffb36682d1e82aec65b83bf1e8d2f8eb5e51b71071d32beb9ecc5170392569ed89181900360600190a1600255506101f1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6100e561015b565b6001600160a01b03811661014f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6101588161008d565b50565b6000546001600160a01b031633146101b55760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610146565b565b600080604083850312156101ca57600080fd5b82516001600160a01b03811681146101e157600080fd5b6020939093015192949293505050565b610e4880620002016000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c8063844638441161006657806384463844146101635780638da5cb5b1461016c578063afa1a19314610187578063f2fde38b1461019a578063f969ec81146101ad57600080fd5b8063086fd3fe146100a3578063359321261461010857806345ab311b1461013357806346c8478814610148578063715018a61461015b575b600080fd5b6100f56100b13660046109e4565b825160208185018101805160038252928201958201959095209190945282518084018501805192815290850193850193909320925291526000908152604090205481565b6040519081526020015b60405180910390f35b6100f5610116366004610a51565b805160208183018101805160018252928201919093012091525481565b610146610141366004610a8e565b6101ee565b005b610146610156366004610ad3565b610273565b6101466102c1565b6100f560025481565b6000546040516001600160a01b0390911681526020016100ff565b610146610195366004610aec565b6102d5565b6101466101a8366004610b6c565b610684565b6100f56101bb366004610b8e565b82516020818501810180516004825292820195820195909520919094528352600091825260408083209093528152205481565b6101f66106fd565b7f7f2080a4b70a3dbf94bc5ca70a475a6ff580fa6e991a4fe83da446d2d16b6d46826001846040516102289190610c09565b90815260405190819003602001812054610246929185903390610c51565b60405180910390a18060018360405161025f9190610c09565b908152604051908190036020019020555050565b61027b6106fd565b60025460408051918252602082018390523382820152517ffb36682d1e82aec65b83bf1e8d2f8eb5e51b71071d32beb9ecc5170392569ed89181900360600190a1600255565b6102c96106fd565b6102d36000610757565b565b8160006001826040516102e89190610c09565b9081526020016040518091039020541161033c5760405162461bcd60e51b815260206004820152601060248201526f19d85b59481b9bdd08185b1b1bddd95960821b60448201526064015b60405180910390fd5b60008060008061034b426107a7565b919450925090508061035e836064610c9f565b61036a85612710610c9f565b6103749190610cbc565b61037e9190610cbc565b93505050506001846040516103939190610c09565b9081526020016040518091039020546003856040516103b29190610c09565b9081526020016040518091039020846040516103ce9190610c09565b90815260200160405180910390206000838152602001908152602001600020541061043b5760405162461bcd60e51b815260206004820152601860248201527f7573657220706c6179206c696d697420657863656564656400000000000000006044820152606401610333565b60018460405161044b9190610c09565b90815260200160405180910390205460048560405161046a9190610c09565b9081526040805160209281900383019020336000908152908352818120858252909252902054106104dd5760405162461bcd60e51b815260206004820152601a60248201527f73656e64657220706c6179206c696d69742065786365656465640000000000006044820152606401610333565b6002546000906104ee600143610ccf565b404160405160200161052593929190928352602083019190915260601b6bffffffffffffffffffffffff1916604082015260540190565b604051602081830303815290604052805190602001209050600160038660405161054f9190610c09565b90815260200160405180910390208560405161056b9190610c09565b9081526020016040518091039020600084815260200190815260200160002060008282546105999190610cbc565b9250508190555060016004866040516105b29190610c09565b9081526040805160209281900383019020336000908152908352818120868252909252812080549091906105e7908490610cbc565b925050819055508060001c6002819055507f316b9ed5316b5b6eaa56fd7df310d81ec79cdd3c8a053f19fd1378f58e2a0c8f858533428660038b60405161062e9190610c09565b90815260200160405180910390208a60405161064a9190610c09565b90815260408051918290036020908101832060008c8152915220546106759695949392918990610ce2565b60405180910390a15050505050565b61068c6106fd565b6001600160a01b0381166106f15760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610333565b6106fa81610757565b50565b6000546001600160a01b031633146102d35760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610333565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080806107c06107bb6201518086610d51565b6107cd565b9196909550909350915050565b60008080838162253d8c6107e48362010bd9610d65565b6107ee9190610d65565b9050600062023ab1610801836004610d8d565b61080b9190610dbd565b9050600461081c8262023ab1610d8d565b610827906003610d65565b6108319190610dbd565b61083b9083610deb565b9150600062164b0961084e846001610d65565b61085a90610fa0610d8d565b6108649190610dbd565b90506004610874826105b5610d8d565b61087e9190610dbd565b6108889084610deb565b61089390601f610d65565b9250600061098f6108a5856050610d8d565b6108af9190610dbd565b9050600060506108c18361098f610d8d565b6108cb9190610dbd565b6108d59086610deb565b90506108e2600b83610dbd565b94506108ef85600c610d8d565b6108fa836002610d65565b6109049190610deb565b91508483610913603187610deb565b61091e906064610d8d565b6109289190610d65565b6109329190610d65565b9a919950975095505050505050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261096857600080fd5b813567ffffffffffffffff8082111561098357610983610941565b604051601f8301601f19908116603f011681019082821181831017156109ab576109ab610941565b816040528381528660208588010111156109c457600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806000606084860312156109f957600080fd5b833567ffffffffffffffff80821115610a1157600080fd5b610a1d87838801610957565b94506020860135915080821115610a3357600080fd5b50610a4086828701610957565b925050604084013590509250925092565b600060208284031215610a6357600080fd5b813567ffffffffffffffff811115610a7a57600080fd5b610a8684828501610957565b949350505050565b60008060408385031215610aa157600080fd5b823567ffffffffffffffff811115610ab857600080fd5b610ac485828601610957565b95602094909401359450505050565b600060208284031215610ae557600080fd5b5035919050565b60008060408385031215610aff57600080fd5b823567ffffffffffffffff80821115610b1757600080fd5b610b2386838701610957565b93506020850135915080821115610b3957600080fd5b50610b4685828601610957565b9150509250929050565b80356001600160a01b0381168114610b6757600080fd5b919050565b600060208284031215610b7e57600080fd5b610b8782610b50565b9392505050565b600080600060608486031215610ba357600080fd5b833567ffffffffffffffff811115610bba57600080fd5b610bc686828701610957565b935050610bd560208501610b50565b9150604084013590509250925092565b60005b83811015610c00578181015183820152602001610be8565b50506000910152565b60008251610c1b818460208701610be5565b9190910192915050565b60008151808452610c3d816020860160208601610be5565b601f01601f19169290920160200192915050565b608081526000610c646080830187610c25565b60208301959095525060408101929092526001600160a01b0316606090910152919050565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610cb657610cb6610c89565b92915050565b80820180821115610cb657610cb6610c89565b81810381811115610cb657610cb6610c89565b60e081526000610cf560e083018a610c25565b8281036020840152610d07818a610c25565b6001600160a01b0398909816604084015250506060810194909452608084019290925260a083015260c09091015292915050565b634e487b7160e01b600052601260045260246000fd5b600082610d6057610d60610d3b565b500490565b8082018281126000831280158216821582161715610d8557610d85610c89565b505092915050565b80820260008212600160ff1b84141615610da957610da9610c89565b8181058314821517610cb657610cb6610c89565b600082610dcc57610dcc610d3b565b600160ff1b821460001984141615610de657610de6610c89565b500590565b8181036000831280158383131683831282161715610e0b57610e0b610c89565b509291505056fea26469706673582212208dc9a230ff09291f444fec0a1740064c16b622cd062cc09fc763efb80b398d5c64736f6c6343000817003300000000000000000000000042dfb2c2ccb7bc5c16c62c0127a91a96ed65063733fb64aa26d7713ebf5df503140ea84a969416f6ece13a50e032e2a0494c63e3

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061009e5760003560e01c8063844638441161006657806384463844146101635780638da5cb5b1461016c578063afa1a19314610187578063f2fde38b1461019a578063f969ec81146101ad57600080fd5b8063086fd3fe146100a3578063359321261461010857806345ab311b1461013357806346c8478814610148578063715018a61461015b575b600080fd5b6100f56100b13660046109e4565b825160208185018101805160038252928201958201959095209190945282518084018501805192815290850193850193909320925291526000908152604090205481565b6040519081526020015b60405180910390f35b6100f5610116366004610a51565b805160208183018101805160018252928201919093012091525481565b610146610141366004610a8e565b6101ee565b005b610146610156366004610ad3565b610273565b6101466102c1565b6100f560025481565b6000546040516001600160a01b0390911681526020016100ff565b610146610195366004610aec565b6102d5565b6101466101a8366004610b6c565b610684565b6100f56101bb366004610b8e565b82516020818501810180516004825292820195820195909520919094528352600091825260408083209093528152205481565b6101f66106fd565b7f7f2080a4b70a3dbf94bc5ca70a475a6ff580fa6e991a4fe83da446d2d16b6d46826001846040516102289190610c09565b90815260405190819003602001812054610246929185903390610c51565b60405180910390a18060018360405161025f9190610c09565b908152604051908190036020019020555050565b61027b6106fd565b60025460408051918252602082018390523382820152517ffb36682d1e82aec65b83bf1e8d2f8eb5e51b71071d32beb9ecc5170392569ed89181900360600190a1600255565b6102c96106fd565b6102d36000610757565b565b8160006001826040516102e89190610c09565b9081526020016040518091039020541161033c5760405162461bcd60e51b815260206004820152601060248201526f19d85b59481b9bdd08185b1b1bddd95960821b60448201526064015b60405180910390fd5b60008060008061034b426107a7565b919450925090508061035e836064610c9f565b61036a85612710610c9f565b6103749190610cbc565b61037e9190610cbc565b93505050506001846040516103939190610c09565b9081526020016040518091039020546003856040516103b29190610c09565b9081526020016040518091039020846040516103ce9190610c09565b90815260200160405180910390206000838152602001908152602001600020541061043b5760405162461bcd60e51b815260206004820152601860248201527f7573657220706c6179206c696d697420657863656564656400000000000000006044820152606401610333565b60018460405161044b9190610c09565b90815260200160405180910390205460048560405161046a9190610c09565b9081526040805160209281900383019020336000908152908352818120858252909252902054106104dd5760405162461bcd60e51b815260206004820152601a60248201527f73656e64657220706c6179206c696d69742065786365656465640000000000006044820152606401610333565b6002546000906104ee600143610ccf565b404160405160200161052593929190928352602083019190915260601b6bffffffffffffffffffffffff1916604082015260540190565b604051602081830303815290604052805190602001209050600160038660405161054f9190610c09565b90815260200160405180910390208560405161056b9190610c09565b9081526020016040518091039020600084815260200190815260200160002060008282546105999190610cbc565b9250508190555060016004866040516105b29190610c09565b9081526040805160209281900383019020336000908152908352818120868252909252812080549091906105e7908490610cbc565b925050819055508060001c6002819055507f316b9ed5316b5b6eaa56fd7df310d81ec79cdd3c8a053f19fd1378f58e2a0c8f858533428660038b60405161062e9190610c09565b90815260200160405180910390208a60405161064a9190610c09565b90815260408051918290036020908101832060008c8152915220546106759695949392918990610ce2565b60405180910390a15050505050565b61068c6106fd565b6001600160a01b0381166106f15760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610333565b6106fa81610757565b50565b6000546001600160a01b031633146102d35760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610333565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080806107c06107bb6201518086610d51565b6107cd565b9196909550909350915050565b60008080838162253d8c6107e48362010bd9610d65565b6107ee9190610d65565b9050600062023ab1610801836004610d8d565b61080b9190610dbd565b9050600461081c8262023ab1610d8d565b610827906003610d65565b6108319190610dbd565b61083b9083610deb565b9150600062164b0961084e846001610d65565b61085a90610fa0610d8d565b6108649190610dbd565b90506004610874826105b5610d8d565b61087e9190610dbd565b6108889084610deb565b61089390601f610d65565b9250600061098f6108a5856050610d8d565b6108af9190610dbd565b9050600060506108c18361098f610d8d565b6108cb9190610dbd565b6108d59086610deb565b90506108e2600b83610dbd565b94506108ef85600c610d8d565b6108fa836002610d65565b6109049190610deb565b91508483610913603187610deb565b61091e906064610d8d565b6109289190610d65565b6109329190610d65565b9a919950975095505050505050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261096857600080fd5b813567ffffffffffffffff8082111561098357610983610941565b604051601f8301601f19908116603f011681019082821181831017156109ab576109ab610941565b816040528381528660208588010111156109c457600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806000606084860312156109f957600080fd5b833567ffffffffffffffff80821115610a1157600080fd5b610a1d87838801610957565b94506020860135915080821115610a3357600080fd5b50610a4086828701610957565b925050604084013590509250925092565b600060208284031215610a6357600080fd5b813567ffffffffffffffff811115610a7a57600080fd5b610a8684828501610957565b949350505050565b60008060408385031215610aa157600080fd5b823567ffffffffffffffff811115610ab857600080fd5b610ac485828601610957565b95602094909401359450505050565b600060208284031215610ae557600080fd5b5035919050565b60008060408385031215610aff57600080fd5b823567ffffffffffffffff80821115610b1757600080fd5b610b2386838701610957565b93506020850135915080821115610b3957600080fd5b50610b4685828601610957565b9150509250929050565b80356001600160a01b0381168114610b6757600080fd5b919050565b600060208284031215610b7e57600080fd5b610b8782610b50565b9392505050565b600080600060608486031215610ba357600080fd5b833567ffffffffffffffff811115610bba57600080fd5b610bc686828701610957565b935050610bd560208501610b50565b9150604084013590509250925092565b60005b83811015610c00578181015183820152602001610be8565b50506000910152565b60008251610c1b818460208701610be5565b9190910192915050565b60008151808452610c3d816020860160208601610be5565b601f01601f19169290920160200192915050565b608081526000610c646080830187610c25565b60208301959095525060408101929092526001600160a01b0316606090910152919050565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610cb657610cb6610c89565b92915050565b80820180821115610cb657610cb6610c89565b81810381811115610cb657610cb6610c89565b60e081526000610cf560e083018a610c25565b8281036020840152610d07818a610c25565b6001600160a01b0398909816604084015250506060810194909452608084019290925260a083015260c09091015292915050565b634e487b7160e01b600052601260045260246000fd5b600082610d6057610d60610d3b565b500490565b8082018281126000831280158216821582161715610d8557610d85610c89565b505092915050565b80820260008212600160ff1b84141615610da957610da9610c89565b8181058314821517610cb657610cb6610c89565b600082610dcc57610dcc610d3b565b600160ff1b821460001984141615610de657610de6610c89565b500590565b8181036000831280158383131683831282161715610e0b57610e0b610c89565b509291505056fea26469706673582212208dc9a230ff09291f444fec0a1740064c16b622cd062cc09fc763efb80b398d5c64736f6c63430008170033

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

00000000000000000000000042dfb2c2ccb7bc5c16c62c0127a91a96ed65063733fb64aa26d7713ebf5df503140ea84a969416f6ece13a50e032e2a0494c63e3

-----Decoded View---------------
Arg [0] : _owner (address): 0x42dFB2C2CCB7Bc5C16C62c0127A91A96ED650637
Arg [1] : _contractSeed (uint256): 23512128652922067676985250863626011753526496581895065179251935970784854172643

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 00000000000000000000000042dfb2c2ccb7bc5c16c62c0127a91a96ed650637
Arg [1] : 33fb64aa26d7713ebf5df503140ea84a969416f6ece13a50e032e2a0494c63e3


Block Transaction Gas Used Reward
view all blocks produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ 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.