Contract 0x2d57f794ab20585b112c57d310872abd6dc69de1

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x232ca7a397c6980be1e9aceea80134d25d2cef239682ff2c87d39e6580bd0ae90x6080604083369392022-03-22 21:19:39194 days 20 hrs ago0xb013abd83f0bd173e9f14ce7d6e420ad711483b4 IN  Create: Randomizer0 ETH0.005360185579 ETH
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x5027ae9964dbb210f4a035fabfa18b90a08064f0c26c55b91be1192414d70dad282053672022-10-03 17:54:5227 secs ago 0x8e79c8607a28fe1ec3527991c89f1d9e36d1bad9 0x2d57f794ab20585b112c57d310872abd6dc69de10 ETH
0xceb9afc74d6dc2a17d7fac6f087d687003668788bc1a61f7dd01c5e26b45959d282053052022-10-03 17:54:141 min ago 0x8e79c8607a28fe1ec3527991c89f1d9e36d1bad9 0x2d57f794ab20585b112c57d310872abd6dc69de10 ETH
0x2406a521a72059e6bd0138adff4068eeea9fdaed50be4aad2a7e08cdacaf95f6282052672022-10-03 17:53:551 min ago 0x8e79c8607a28fe1ec3527991c89f1d9e36d1bad9 0x2d57f794ab20585b112c57d310872abd6dc69de10 ETH
0x2406a521a72059e6bd0138adff4068eeea9fdaed50be4aad2a7e08cdacaf95f6282052672022-10-03 17:53:551 min ago 0x8e79c8607a28fe1ec3527991c89f1d9e36d1bad9 0x2d57f794ab20585b112c57d310872abd6dc69de10 ETH
0x2406a521a72059e6bd0138adff4068eeea9fdaed50be4aad2a7e08cdacaf95f6282052672022-10-03 17:53:551 min ago 0x8e79c8607a28fe1ec3527991c89f1d9e36d1bad9 0x2d57f794ab20585b112c57d310872abd6dc69de10 ETH
0x2406a521a72059e6bd0138adff4068eeea9fdaed50be4aad2a7e08cdacaf95f6282052672022-10-03 17:53:551 min ago 0x8e79c8607a28fe1ec3527991c89f1d9e36d1bad9 0x2d57f794ab20585b112c57d310872abd6dc69de10 ETH
0x2406a521a72059e6bd0138adff4068eeea9fdaed50be4aad2a7e08cdacaf95f6282052672022-10-03 17:53:551 min ago 0x8e79c8607a28fe1ec3527991c89f1d9e36d1bad9 0x2d57f794ab20585b112c57d310872abd6dc69de10 ETH
0x36faf2fcccdb91fa454d73296caae0c4413f530bc28de81a9fd5968572e5fd6e282052132022-10-03 17:53:192 mins ago 0x8e79c8607a28fe1ec3527991c89f1d9e36d1bad9 0x2d57f794ab20585b112c57d310872abd6dc69de10 ETH
0x53a393ba0d42d24c2e02d77fae57a7f41bae0dc93fbae6eab35e5f3c0aeceaad282051792022-10-03 17:52:572 mins ago 0x8e79c8607a28fe1ec3527991c89f1d9e36d1bad9 0x2d57f794ab20585b112c57d310872abd6dc69de10 ETH
0x53a393ba0d42d24c2e02d77fae57a7f41bae0dc93fbae6eab35e5f3c0aeceaad282051792022-10-03 17:52:572 mins ago 0x8e79c8607a28fe1ec3527991c89f1d9e36d1bad9 0x2d57f794ab20585b112c57d310872abd6dc69de10 ETH
0xfef323714f667f0d7ab9f5d6d428e2cfae922fc1a2cf0430896f9818db4a4125282051132022-10-03 17:52:202 mins ago 0x8e79c8607a28fe1ec3527991c89f1d9e36d1bad9 0x2d57f794ab20585b112c57d310872abd6dc69de10 ETH
0xfef323714f667f0d7ab9f5d6d428e2cfae922fc1a2cf0430896f9818db4a4125282051132022-10-03 17:52:202 mins ago 0x8e79c8607a28fe1ec3527991c89f1d9e36d1bad9 0x2d57f794ab20585b112c57d310872abd6dc69de10 ETH
0xfef323714f667f0d7ab9f5d6d428e2cfae922fc1a2cf0430896f9818db4a4125282051132022-10-03 17:52:202 mins ago 0x8e79c8607a28fe1ec3527991c89f1d9e36d1bad9 0x2d57f794ab20585b112c57d310872abd6dc69de10 ETH
0xfef323714f667f0d7ab9f5d6d428e2cfae922fc1a2cf0430896f9818db4a4125282051132022-10-03 17:52:202 mins ago 0x8e79c8607a28fe1ec3527991c89f1d9e36d1bad9 0x2d57f794ab20585b112c57d310872abd6dc69de10 ETH
0xfef323714f667f0d7ab9f5d6d428e2cfae922fc1a2cf0430896f9818db4a4125282051132022-10-03 17:52:202 mins ago 0x8e79c8607a28fe1ec3527991c89f1d9e36d1bad9 0x2d57f794ab20585b112c57d310872abd6dc69de10 ETH
0xfef323714f667f0d7ab9f5d6d428e2cfae922fc1a2cf0430896f9818db4a4125282051132022-10-03 17:52:202 mins ago 0x8e79c8607a28fe1ec3527991c89f1d9e36d1bad9 0x2d57f794ab20585b112c57d310872abd6dc69de10 ETH
0xfef323714f667f0d7ab9f5d6d428e2cfae922fc1a2cf0430896f9818db4a4125282051132022-10-03 17:52:202 mins ago 0x8e79c8607a28fe1ec3527991c89f1d9e36d1bad9 0x2d57f794ab20585b112c57d310872abd6dc69de10 ETH
0xfef323714f667f0d7ab9f5d6d428e2cfae922fc1a2cf0430896f9818db4a4125282051132022-10-03 17:52:202 mins ago 0x8e79c8607a28fe1ec3527991c89f1d9e36d1bad9 0x2d57f794ab20585b112c57d310872abd6dc69de10 ETH
0xfef323714f667f0d7ab9f5d6d428e2cfae922fc1a2cf0430896f9818db4a4125282051132022-10-03 17:52:202 mins ago 0x8e79c8607a28fe1ec3527991c89f1d9e36d1bad9 0x2d57f794ab20585b112c57d310872abd6dc69de10 ETH
0xfef323714f667f0d7ab9f5d6d428e2cfae922fc1a2cf0430896f9818db4a4125282051132022-10-03 17:52:202 mins ago 0x8e79c8607a28fe1ec3527991c89f1d9e36d1bad9 0x2d57f794ab20585b112c57d310872abd6dc69de10 ETH
0xfef323714f667f0d7ab9f5d6d428e2cfae922fc1a2cf0430896f9818db4a4125282051132022-10-03 17:52:202 mins ago 0x8e79c8607a28fe1ec3527991c89f1d9e36d1bad9 0x2d57f794ab20585b112c57d310872abd6dc69de10 ETH
0xfef323714f667f0d7ab9f5d6d428e2cfae922fc1a2cf0430896f9818db4a4125282051132022-10-03 17:52:202 mins ago 0x8e79c8607a28fe1ec3527991c89f1d9e36d1bad9 0x2d57f794ab20585b112c57d310872abd6dc69de10 ETH
0xfef323714f667f0d7ab9f5d6d428e2cfae922fc1a2cf0430896f9818db4a4125282051132022-10-03 17:52:202 mins ago 0x8e79c8607a28fe1ec3527991c89f1d9e36d1bad9 0x2d57f794ab20585b112c57d310872abd6dc69de10 ETH
0xfef323714f667f0d7ab9f5d6d428e2cfae922fc1a2cf0430896f9818db4a4125282051132022-10-03 17:52:202 mins ago 0x8e79c8607a28fe1ec3527991c89f1d9e36d1bad9 0x2d57f794ab20585b112c57d310872abd6dc69de10 ETH
0xfef323714f667f0d7ab9f5d6d428e2cfae922fc1a2cf0430896f9818db4a4125282051132022-10-03 17:52:202 mins ago 0x8e79c8607a28fe1ec3527991c89f1d9e36d1bad9 0x2d57f794ab20585b112c57d310872abd6dc69de10 ETH
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Randomizer

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 10 : Randomizer.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "../AdminableUpgradeable.sol";
import "./IRandomizer.sol";
import "./RandomizerState.sol";

// Single implementation of randomizer. Currently does not use ChainLink VRF as CL is not supported on Arbitrum.
// When CL supports Arbitrum, the goal is to switch this contract to use VRF.
// Open for all to use.
contract Randomizer is IRandomizer, RandomizerState {

    function initialize() external initializer {
        RandomizerState.__RandomizerState_init();
    }

    function setNumBlocksAfterIncrement(uint8 _numBlocksAfterIncrement) external override onlyAdminOrOwner {
        numBlocksAfterIncrement = _numBlocksAfterIncrement;
    }

    function setNumBlocksUntilNextIncrement(uint8 _numBlocksUntilNextIncrement) external onlyAdminOrOwner {
        numBlocksUntilNextIncrement = _numBlocksUntilNextIncrement;
    }

    function incrementCommitId() external override onlyAdminOrOwner {
        require(pendingCommits > 0, "No pending requests");
        _incrementCommitId();
    }

    function addRandomForCommit(uint256 _seed) external override onlyAdminOrOwner {
        require(block.number >= lastIncrementBlockNum + numBlocksAfterIncrement, "No random on same block");
        require(commitId > nextCommitIdToSeed, "Commit id must be higher");

        commitIdToRandomSeed[nextCommitIdToSeed] = _seed;

        emit RandomSeeded(nextCommitIdToSeed);

        nextCommitIdToSeed++;
    }

    function requestRandomNumber() external override returns(uint256) {
        uint256 _requestId = requestIdCur;

        requestIdToCommitId[_requestId] = commitId;

        requestIdCur++;
        pendingCommits++;

        emit RandomRequest(_requestId, commitId);

        // If not caught up on seeding, don't bother pushing the commit id foward.
        // Will save us gas later.
        if(commitId == nextCommitIdToSeed
            && numBlocksUntilNextIncrement > 0
            && lastIncrementBlockNum + numBlocksUntilNextIncrement <= block.number)
        {
            _incrementCommitId();
        }

        return _requestId;
    }

    function _incrementCommitId() private {
        commitId++;
        lastIncrementBlockNum = block.number;
        pendingCommits = 0;
    }

    function revealRandomNumber(uint256 _requestId) external view override returns(uint256) {
        uint256 _commitIdForRequest = requestIdToCommitId[_requestId];
        require(_commitIdForRequest > 0, "Bad request ID");

        uint256 _randomSeed = commitIdToRandomSeed[_commitIdForRequest];
        require(_randomSeed > 0, "Random seed not set");

        // Combine the seed with the request id so each request id on this commit has a different number
        uint256 randomNumber = uint256(keccak256(abi.encode(_randomSeed, _requestId)));

        return randomNumber;
    }

    function isRandomReady(uint256 _requestId) external view override returns(bool) {
        return commitIdToRandomSeed[requestIdToCommitId[_requestId]] != 0;
    }
}

File 2 of 10 : AdminableUpgradeable.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

import "./UtilitiesUpgradeable.sol";

// Do not add state to this contract.
//
contract AdminableUpgradeable is UtilitiesUpgradeable {

    mapping(address => bool) private admins;

    function __Adminable_init() internal initializer {
        UtilitiesUpgradeable.__Utilities__init();
    }

    function addAdmin(address _address) external onlyOwner {
        admins[_address] = true;
    }

    function addAdmins(address[] calldata _addresses) external onlyOwner {
        for(uint256 i = 0; i < _addresses.length; i++) {
            admins[_addresses[i]] = true;
        }
    }

    function removeAdmin(address _address) external onlyOwner {
        admins[_address] = false;
    }

    function removeAdmins(address[] calldata _addresses) external onlyOwner {
        for(uint256 i = 0; i < _addresses.length; i++) {
            admins[_addresses[i]] = false;
        }
    }

    function setPause(bool _shouldPause) external onlyAdminOrOwner {
        if(_shouldPause) {
            _pause();
        } else {
            _unpause();
        }
    }

    function isAdmin(address _address) public view returns(bool) {
        return admins[_address];
    }

    modifier onlyAdmin() {
        require(admins[msg.sender], "Not admin");
        _;
    }

    modifier onlyAdminOrOwner() {
        require(admins[msg.sender] || isOwner(), "Not admin or owner");
        _;
    }

    uint256[50] private __gap;
}

File 3 of 10 : IRandomizer.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IRandomizer {

    // Sets the number of blocks that must pass between increment the commitId and seeding the random
    // Admin
    function setNumBlocksAfterIncrement(uint8 _numBlocksAfterIncrement) external;

    // Increments the commit id.
    // Admin
    function incrementCommitId() external;

    // Adding the random number needs to be done AFTER incrementing the commit id on a separate transaction. If
    // these are done together, there is a potential vulnerability to front load a commit when the bad actor
    // sees the value of the random number.
    function addRandomForCommit(uint256 _seed) external;

    // Returns a request ID for a random number. This is unique.
    function requestRandomNumber() external returns(uint256);

    // Returns the random number for the given request ID. Will revert
    // if the random is not ready.
    function revealRandomNumber(uint256 _requestId) external view returns(uint256);

    // Returns if the random number for the given request ID is ready or not. Call
    // before calling revealRandomNumber.
    function isRandomReady(uint256 _requestId) external view returns(bool);
}

File 4 of 10 : RandomizerState.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

import "../../shared/AdminableUpgradeable.sol";

contract RandomizerState is Initializable, AdminableUpgradeable {

    event RandomRequest(uint256 indexed _requestId, uint256 indexed _commitId);
    event RandomSeeded(uint256 indexed _commitId);

    // RandomIds that are a part of this commit.
    mapping(uint256 => uint256) internal commitIdToRandomSeed;
    mapping(uint256 => uint256) internal requestIdToCommitId;

    uint256 public lastIncrementBlockNum;
    uint256 public commitId;
    uint256 public requestIdCur;
    uint256 public nextCommitIdToSeed;
    uint256 public pendingCommits;
    // The number of blocks after the increment ID was incremeneted that the seed must be supplied after
    uint8 public numBlocksAfterIncrement;
    // The number of blocks between the last increment and the next time the commit will be incremented.
    // This only applies to other contracts requesting a random, and us piggy backing of of
    // their request to increment the ID.
    uint8 public numBlocksUntilNextIncrement;

    function __RandomizerState_init() internal initializer {
        AdminableUpgradeable.__Adminable_init();

        numBlocksAfterIncrement = 1;
        requestIdCur = 1;
        nextCommitIdToSeed = 1;
        commitId = 1;
        numBlocksUntilNextIncrement = 0;
    }
}

File 5 of 10 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/utils/Initializable.sol)

pragma solidity ^0.8.0;

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 a proxied contract can't have 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.
 *
 * 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 initialize the implementation contract, you can either invoke the
 * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() initializer {}
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        // If the contract is initializing we ignore whether _initialized is set in order to support multiple
        // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the
        // contract may have been reentered.
        require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} modifier, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    function _isConstructor() private view returns (bool) {
        return !AddressUpgradeable.isContract(address(this));
    }
}

File 6 of 10 : UtilitiesUpgradeable.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

contract UtilitiesUpgradeable is Initializable, OwnableUpgradeable, PausableUpgradeable {

    function __Utilities__init() internal initializer {
        OwnableUpgradeable.__Ownable_init();
        PausableUpgradeable.__Pausable_init();

        _pause();
    }

    modifier nonZeroAddress(address _address) {
        require(address(0) != _address, "0 address");
        _;
    }

    modifier nonZeroLength(uint[] memory _array) {
        require(_array.length > 0, "Empty array");
        _;
    }

    modifier lengthsAreEqual(uint[] memory _array1, uint[] memory _array2) {
        require(_array1.length == _array2.length, "Unequal lengths");
        _;
    }

    modifier onlyEOA() {
        /* solhint-disable avoid-tx-origin */
        require(msg.sender == tx.origin, "No contracts");
        _;
    }

    function isOwner() internal view returns(bool) {
        return owner() == msg.sender;
    }
}

File 7 of 10 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)

pragma solidity ^0.8.0;

/**
 * @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
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 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

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 8 of 10 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.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 OwnableUpgradeable is Initializable, ContextUpgradeable {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init() internal onlyInitializing {
        __Context_init_unchained();
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal onlyInitializing {
        _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);
    }
    uint256[49] private __gap;
}

File 9 of 10 : PausableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    function __Pausable_init() internal onlyInitializing {
        __Context_init_unchained();
        __Pausable_init_unchained();
    }

    function __Pausable_init_unchained() internal onlyInitializing {
        _paused = false;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        require(!paused(), "Pausable: paused");
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        require(paused(), "Pausable: not paused");
        _;
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
    uint256[49] private __gap;
}

File 10 of 10 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @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 ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
        __Context_init_unchained();
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
    uint256[50] private __gap;
}

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

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_requestId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"_commitId","type":"uint256"}],"name":"RandomRequest","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_commitId","type":"uint256"}],"name":"RandomSeeded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"addAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_addresses","type":"address[]"}],"name":"addAdmins","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_seed","type":"uint256"}],"name":"addRandomForCommit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"commitId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"incrementCommitId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"isAdmin","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_requestId","type":"uint256"}],"name":"isRandomReady","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastIncrementBlockNum","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextCommitIdToSeed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numBlocksAfterIncrement","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numBlocksUntilNextIncrement","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","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":[],"name":"pendingCommits","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"removeAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_addresses","type":"address[]"}],"name":"removeAdmins","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"requestIdCur","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"requestRandomNumber","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_requestId","type":"uint256"}],"name":"revealRandomNumber","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"_numBlocksAfterIncrement","type":"uint8"}],"name":"setNumBlocksAfterIncrement","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"_numBlocksUntilNextIncrement","type":"uint8"}],"name":"setNumBlocksUntilNextIncrement","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_shouldPause","type":"bool"}],"name":"setPause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50611183806100206000396000f3fe608060405234801561001057600080fd5b50600436106101735760003560e01c80638678a7b2116100de578063bedb86fb11610097578063e9b5c76c11610071578063e9b5c76c146102fd578063ee7524a414610305578063f030210714610318578063f2fde38b1461034757600080fd5b8063bedb86fb146102c4578063d3b88706146102d7578063deca9ee1146102ea57600080fd5b80638678a7b21461026a57806387a369c6146102725780638da5cb5b146102845780639c54df641461029f578063a447caaf146102b2578063b2941705146102bb57600080fd5b80635c975abb116101305780635c975abb1461022a5780637048027514610235578063715018a6146102485780637dd65acb146102505780637eaaa2e1146102595780638129fc1c1461026257600080fd5b80631785f53c1461017857806324d7806c1461018d578063307a19a7146101ce578063377e11e0146101ed5780634ad30a7514610200578063595c9bcf14610221575b600080fd5b61018b610186366004610ef1565b61035a565b005b6101b961019b366004610ef1565b6001600160a01b031660009081526097602052604090205460ff1690565b60405190151581526020015b60405180910390f35b60d1546101db9060ff1681565b60405160ff90911681526020016101c5565b61018b6101fb366004610f21565b6103ae565b61021361020e366004610f96565b61044f565b6040519081526020016101c5565b61021360cd5481565b60655460ff166101b9565b61018b610243366004610ef1565b610520565b61018b61056e565b61021360ce5481565b61021360d05481565b61018b6105a4565b61021361061e565b60d1546101db90610100900460ff1681565b6033546040516001600160a01b0390911681526020016101c5565b61018b6102ad366004610f21565b6106e0565b61021360cc5481565b61021360cf5481565b61018b6102d2366004610faf565b61077c565b61018b6102e5366004610fd1565b6107cf565b61018b6102f8366004610fd1565b610822565b61018b61087b565b61018b610313366004610f96565b610908565b6101b9610326366004610f96565b600090815260cb6020908152604080832054835260ca909152902054151590565b61018b610355366004610ef1565b610a50565b6033546001600160a01b0316331461038d5760405162461bcd60e51b815260040161038490610ff4565b60405180910390fd5b6001600160a01b03166000908152609760205260409020805460ff19169055565b6033546001600160a01b031633146103d85760405162461bcd60e51b815260040161038490610ff4565b60005b8181101561044a576000609760008585858181106103fb576103fb611029565b90506020020160208101906104109190610ef1565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790558061044281611055565b9150506103db565b505050565b600081815260cb60205260408120548061049c5760405162461bcd60e51b815260206004820152600e60248201526d109859081c995c5d595cdd08125160921b6044820152606401610384565b600081815260ca6020526040902054806104ee5760405162461bcd60e51b815260206004820152601360248201527214985b991bdb481cd95959081b9bdd081cd95d606a1b6044820152606401610384565b604080516020808201939093528082019590955280518086038201815260609095019052835193019290922092915050565b6033546001600160a01b0316331461054a5760405162461bcd60e51b815260040161038490610ff4565b6001600160a01b03166000908152609760205260409020805460ff19166001179055565b6033546001600160a01b031633146105985760405162461bcd60e51b815260040161038490610ff4565b6105a26000610ae4565b565b600054610100900460ff166105bf5760005460ff16156105c3565b303b155b6105df5760405162461bcd60e51b815260040161038490611070565b600054610100900460ff16158015610601576000805461ffff19166101011790555b610609610b36565b801561061b576000805461ff00191690555b50565b60ce805460cd54600082815260cb6020526040812091909155825490928361064583611055565b909155505060d0805490600061065a83611055565b909155505060cd5460405182907f677f6be60ac059b4a229db4ae65d54188e85947c7f2936fa256bc41724cbe2c990600090a360cf5460cd541480156106a9575060d154610100900460ff1615155b80156106ce575060d15460cc5443916106cb9161010090910460ff16906110be565b11155b156106db576106db610bce565b919050565b6033546001600160a01b0316331461070a5760405162461bcd60e51b815260040161038490610ff4565b60005b8181101561044a5760016097600085858581811061072d5761072d611029565b90506020020160208101906107429190610ef1565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790558061077481611055565b91505061070d565b3360009081526097602052604090205460ff168061079d575061079d610bee565b6107b95760405162461bcd60e51b8152600401610384906110d6565b80156107c75761061b610c12565b61061b610caa565b3360009081526097602052604090205460ff16806107f057506107f0610bee565b61080c5760405162461bcd60e51b8152600401610384906110d6565b60d1805460ff191660ff92909216919091179055565b3360009081526097602052604090205460ff16806108435750610843610bee565b61085f5760405162461bcd60e51b8152600401610384906110d6565b60d1805460ff9092166101000261ff0019909216919091179055565b3360009081526097602052604090205460ff168061089c575061089c610bee565b6108b85760405162461bcd60e51b8152600401610384906110d6565b600060d054116109005760405162461bcd60e51b81526020600482015260136024820152724e6f2070656e64696e6720726571756573747360681b6044820152606401610384565b6105a2610bce565b3360009081526097602052604090205460ff16806109295750610929610bee565b6109455760405162461bcd60e51b8152600401610384906110d6565b60d15460cc546109589160ff16906110be565b4310156109a75760405162461bcd60e51b815260206004820152601760248201527f4e6f2072616e646f6d206f6e2073616d6520626c6f636b0000000000000000006044820152606401610384565b60cf5460cd54116109fa5760405162461bcd60e51b815260206004820152601860248201527f436f6d6d6974206964206d7573742062652068696768657200000000000000006044820152606401610384565b60cf8054600090815260ca6020526040808220849055915491517fa6c3d87664b2a3e83d71f07f3d81066b4e4b107780504cdcff41309eb23abbd09190a260cf8054906000610a4883611055565b919050555050565b6033546001600160a01b03163314610a7a5760405162461bcd60e51b815260040161038490610ff4565b6001600160a01b038116610adf5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610384565b61061b815b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff16610b515760005460ff1615610b55565b303b155b610b715760405162461bcd60e51b815260040161038490611070565b600054610100900460ff16158015610b93576000805461ffff19166101011790555b610b9b610d24565b60d18054600160ce81905560cf81905560cd81905561ffff19909116179055801561061b576000805461ff001916905550565b60cd8054906000610bde83611055565b90915550504360cc55600060d055565b600033610c036033546001600160a01b031690565b6001600160a01b031614905090565b60655460ff1615610c585760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610384565b6065805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610c8d3390565b6040516001600160a01b03909116815260200160405180910390a1565b60655460ff16610cf35760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610384565b6065805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33610c8d565b600054610100900460ff16610d3f5760005460ff1615610d43565b303b155b610d5f5760405162461bcd60e51b815260040161038490611070565b600054610100900460ff16158015610d81576000805461ffff19166101011790555b610609600054610100900460ff16610d9f5760005460ff1615610da3565b303b155b610dbf5760405162461bcd60e51b815260040161038490611070565b600054610100900460ff16158015610de1576000805461ffff19166101011790555b610de9610df9565b610df1610e30565b610609610c12565b600054610100900460ff16610e205760405162461bcd60e51b815260040161038490611102565b610e28610e67565b6105a2610e8e565b600054610100900460ff16610e575760405162461bcd60e51b815260040161038490611102565b610e5f610e67565b6105a2610ebe565b600054610100900460ff166105a25760405162461bcd60e51b815260040161038490611102565b600054610100900460ff16610eb55760405162461bcd60e51b815260040161038490611102565b6105a233610ae4565b600054610100900460ff16610ee55760405162461bcd60e51b815260040161038490611102565b6065805460ff19169055565b600060208284031215610f0357600080fd5b81356001600160a01b0381168114610f1a57600080fd5b9392505050565b60008060208385031215610f3457600080fd5b823567ffffffffffffffff80821115610f4c57600080fd5b818501915085601f830112610f6057600080fd5b813581811115610f6f57600080fd5b8660208260051b8501011115610f8457600080fd5b60209290920196919550909350505050565b600060208284031215610fa857600080fd5b5035919050565b600060208284031215610fc157600080fd5b81358015158114610f1a57600080fd5b600060208284031215610fe357600080fd5b813560ff81168114610f1a57600080fd5b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156110695761106961103f565b5060010190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b600082198211156110d1576110d161103f565b500190565b6020808252601290820152712737ba1030b236b4b71037b91037bbb732b960711b604082015260600190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fea2646970667358221220e42169456dc56d3a744fa0dc000ac9335609c6c6e60524d801ef83fa3025b9d164736f6c63430008090033

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