ETH Price: $3,152.41 (+2.54%)
Gas: 9 Gwei

Contract

0x4C6fA38C9F6c19a640A673c7EA45b1e89101c5E7
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Request Random W...195263572024-03-27 14:51:3518 days ago1711551095IN
0x4C6fA38C...89101c5E7
0 ETH0.0071439143.25266942
Request Random W...195263532024-03-27 14:50:4718 days ago1711551047IN
0x4C6fA38C...89101c5E7
0 ETH0.0070436742.68300143
Request Random W...195252802024-03-27 11:10:4718 days ago1711537847IN
0x4C6fA38C...89101c5E7
0 ETH0.0035196521.32827234
Request Random W...195001252024-03-23 22:00:3522 days ago1711231235IN
0x4C6fA38C...89101c5E7
0 ETH0.0031776819.25881965
Request Random W...195001232024-03-23 22:00:1122 days ago1711231211IN
0x4C6fA38C...89101c5E7
0 ETH0.0030510118.47501616
Request Random W...192649322024-02-19 23:05:4755 days ago1708383947IN
0x4C6fA38C...89101c5E7
0 ETH0.0053236632.22496665
Request Random W...192649292024-02-19 23:05:1155 days ago1708383911IN
0x4C6fA38C...89101c5E7
0 ETH0.0056086933.98239037
Request Random W...189764762024-01-10 12:13:3595 days ago1704888815IN
0x4C6fA38C...89101c5E7
0 ETH0.0039952224.21537117
Request Random W...153217372022-08-11 16:24:41612 days ago1660235081IN
0x4C6fA38C...89101c5E7
0 ETH0.0051696731.340657
Request Random W...151798542022-07-20 13:44:24634 days ago1658324664IN
0x4C6fA38C...89101c5E7
0 ETH0.0027758716.82603083
Grant Role151659772022-07-18 10:05:34636 days ago1658138734IN
0x4C6fA38C...89101c5E7
0 ETH0.0011602422.54443259
Request Random W...149969862022-06-20 14:11:01664 days ago1655734261IN
0x4C6fA38C...89101c5E7
0 ETH0.0089811449.32664792
Create New Subsc...149969552022-06-20 14:03:58664 days ago1655733838IN
0x4C6fA38C...89101c5E7
0 ETH0.004195229.82536898
Request Random W...149968842022-06-20 13:47:06664 days ago1655732826IN
0x4C6fA38C...89101c5E7
0 ETH0.0011810427.15355846
Set Subscription...149968552022-06-20 13:40:23664 days ago1655732423IN
0x4C6fA38C...89101c5E7
0 ETH0.000993921.5686771
0x60a06040149968072022-06-20 13:30:03664 days ago1655731803IN
 Create: RandomSeed
0 ETH0.0395401226.79133221

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
RandomSeed

Compiler Version
v0.8.15+commit.e14f2714

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 10 : RandomSeed.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.7;

import "@openzeppelin/contracts/access/AccessControl.sol";

import "@chainlink/contracts/src/v0.8/interfaces/LinkTokenInterface.sol";
import "@chainlink/contracts/src/v0.8/interfaces/VRFCoordinatorV2Interface.sol";
import "@chainlink/contracts/src/v0.8/VRFConsumerBaseV2.sol";

contract RandomSeed is VRFConsumerBaseV2, AccessControl {
    bytes32 public constant RANDOM_REQUESTER_ROLE = keccak256("RANDOM_REQUESTER_ROLE");

    VRFCoordinatorV2Interface COORDINATOR;
    LinkTokenInterface LINKTOKEN;

    // VRF coordinator. For other networks see ...
    // https://docs.chain.link/docs/vrf-contracts/#configurations
    // address public constant vrfCoordinator = 0x6168499c0cFfCaCD319c818142124B7A15E857ab; // Rinkeby
    address public constant vrfCoordinator = 0x271682DEB8C4E0901D1a1550aD2e64D568E69909; // Eth mainnet

    // LINK token contract. For other networks, see ...
    // https://docs.chain.link/docs/vrf-contracts/#configurations
    // address public constant link_token_contract = 0x01BE23585060835E02B77ef475b0Cc51aA1e0709; // Rinkeby
    address public constant link_token_contract = 0x514910771AF9Ca656af840dff83E8264EcF986CA; // Eth mainnet

    // The gas lane to use, which specifies the maximum gas price to bump to.
    // For a list of available gas lanes on each network,
    // see https://docs.chain.link/docs/vrf-contracts/#configurations
    // bytes32 public keyHash = 0xd89b2bf150e3b9e13446986e571fb9cab24b13cea0a43ea20a6049a85cc807cc; // Rinkeby
    bytes32 public keyHash = 0x8af398995b04c28e9951adb9721ef74c74f93e6a478f39e7e0777be13527e7ef; // Eth mainnet  200 gwei
    //  bytes32 public keyHash = 0xff8dedfbfa60af186cf3c830acbc32c05aae823045ae5ea7da1e45fbfaba4f92; // Eth mainnet  500 gwei
    //  bytes32 public keyHash = 0x9fe0eebf5e446e3c998ec9bb19951541aee00bb90ea201ae456421a2ded86805; // Eth mainnet 1000 gwei

    // A reasonable default is 100000, but this value could be different
    // on other networks.
    uint32 public constant callbackGasLimit = 100000;

    // The default is 3, but you can set this higher.
    uint16 public constant requestConfirmations = 3;

    // Retrieve 1 random values in one request.
    // Cannot exceed VRFCoordinatorV2.MAX_NUM_WORDS.
    uint32 public constant numWords = 1;

    // Storage parameters
    uint64 public s_subscriptionId;

    struct RandomRequest {
        // uint32 chainId;     //  4 Bytes
        uint48 requestTime; //  6 Bytes
        uint48 scheduledTime; //  6 Bytes
        uint48 fullFilledTime; //  6 Bytes
        uint256 requestId; // 32 Bytes
        uint256 randomNumber; // 32 Bytes
    }

    mapping(bytes32 => RandomRequest) public randomRequests; // projectName => RandomRequest
    mapping(uint256 => bytes32) public requestId_to_contract; // requestid => chainId + projectName
    bytes32[] public randomRequestsList;

    modifier onlyOwner() {
        require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "caller has not admin role");
        _;
    }

    modifier onlyRandomRequesterRole() {
        require(hasRole(RANDOM_REQUESTER_ROLE, msg.sender), "caller has not RandomRequesterRole");
        _;
    }

    /**
     * @dev CONSTRUCTOR
     */

    constructor() VRFConsumerBaseV2(vrfCoordinator) {
        _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
        _setupRole(RANDOM_REQUESTER_ROLE, msg.sender);
        COORDINATOR = VRFCoordinatorV2Interface(vrfCoordinator);
        LINKTOKEN = LinkTokenInterface(link_token_contract);
        // createNewSubscription(); // Create a new subscription when you deploy the contract.
    }

    /**
     * @dev map a chainID and a contract address to a uint256
     * @param _chainId of blockchain where contract is deployed
     * @param _contractAddress contract address
     */
    function chainIdAddressToUint256(uint32 _chainId, address _contractAddress) public pure returns (uint256) {
        return (uint256(_chainId) << 160) | uint256(uint160(_contractAddress));
    }

    function bytesToBytes32(bytes memory source) private pure returns (bytes32 result) {
        if (source.length == 0) {
            return 0x0;
        }
        assembly {
            result := mload(add(source, 32))
        }
    }

    function stringToBytes32(string memory projectNameString) public pure returns (bytes32) {
        return bytes32(bytes(projectNameString));
    }

    /**
     * @dev Request a random number from Chainlink VRF Oracle
     * @dev Assumes the subscription is funded sufficiently.
     * @dev Will revert if subscription is not set and funded.
     * @param projectNameString name of project
     */
    function requestRandomWords(string memory projectNameString) external onlyRandomRequesterRole {
        bytes32 projectName = stringToBytes32(projectNameString);
        require(randomRequests[projectName].requestId == 0, "random number already requested");

        uint256 requestId = COORDINATOR.requestRandomWords(
            keyHash,
            s_subscriptionId,
            requestConfirmations,
            callbackGasLimit,
            numWords
        );

        randomRequests[projectName].requestTime = uint48(block.timestamp);
        randomRequests[projectName].requestId = requestId;
        requestId_to_contract[requestId] = projectName;
        randomRequestsList.push(projectName);
    }

    /**
     * @dev Chainlink VRF oracle will call this function to deliver the random number
     */
    function fulfillRandomWords(uint256 requestId, uint256[] memory randomWords) internal override {
        bytes32 projectName = requestId_to_contract[requestId];
        randomRequests[projectName].randomNumber = randomWords[0];
        randomRequests[projectName].fullFilledTime = uint48(block.timestamp);
    }

    function getRandomNumber(string memory projectNameString) public view returns (uint256) {
        bytes32 projectName = stringToBytes32(projectNameString);
        return randomRequests[projectName].randomNumber;
    }

    function getScheduleRequest(string memory projectNameString) public view returns (RandomRequest memory) {
        bytes32 projectName = stringToBytes32(projectNameString);
        return randomRequests[projectName];
    }

    // Create a new subscription when the contract is initially deployed.
    function createNewSubscription() public onlyOwner {
        // Create a subscription with a new subscription ID.
        address[] memory consumers = new address[](1);
        consumers[0] = address(this);
        s_subscriptionId = COORDINATOR.createSubscription();
        // Add this contract as a consumer of its own subscription.
        COORDINATOR.addConsumer(s_subscriptionId, consumers[0]);
    }

    // set or update keyHash
    function setKeyHash(bytes32 _keyHash) external onlyOwner {
        keyHash = _keyHash;
    }

    // update subscriptionId
    function setSubscriptionId(uint64 _s_subscriptionId) external onlyOwner {
        s_subscriptionId = _s_subscriptionId;
    }

    // Assumes this contract owns link.
    // 1000000000000000000 = 1 LINK
    function topUpSubscription(uint256 amount) external onlyOwner {
        LINKTOKEN.transferAndCall(address(COORDINATOR), amount, abi.encode(s_subscriptionId));
    }

    // Add a consumer contract to the subscription.
    function addConsumer(address consumerAddress) external onlyOwner {
        COORDINATOR.addConsumer(s_subscriptionId, consumerAddress);
    }

    // Remove a consumer contract from the subscription.
    function removeConsumer(address consumerAddress) external onlyOwner {
        COORDINATOR.removeConsumer(s_subscriptionId, consumerAddress);
    }

    // Cancel the subscription and send the remaining LINK to a wallet address.
    function cancelSubscription(address receivingWallet) external onlyOwner {
        COORDINATOR.cancelSubscription(s_subscriptionId, receivingWallet);
        s_subscriptionId = 0;
    }

    // Transfer this contract's funds to an address.
    // 1000000000000000000 = 1 LINK
    function withdraw(uint256 amount, address to) external onlyOwner {
        LINKTOKEN.transfer(to, amount);
    }
}

File 3 of 10 : AccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `_msgSender()` is missing `role`.
     * Overriding this function changes the behavior of the {onlyRole} modifier.
     *
     * Format of the revert message is described in {_checkRole}.
     *
     * _Available since v4.6._
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(uint160(account), 20),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

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

interface LinkTokenInterface {
  function allowance(address owner, address spender) external view returns (uint256 remaining);

  function approve(address spender, uint256 value) external returns (bool success);

  function balanceOf(address owner) external view returns (uint256 balance);

  function decimals() external view returns (uint8 decimalPlaces);

  function decreaseApproval(address spender, uint256 addedValue) external returns (bool success);

  function increaseApproval(address spender, uint256 subtractedValue) external;

  function name() external view returns (string memory tokenName);

  function symbol() external view returns (string memory tokenSymbol);

  function totalSupply() external view returns (uint256 totalTokensIssued);

  function transfer(address to, uint256 value) external returns (bool success);

  function transferAndCall(
    address to,
    uint256 value,
    bytes calldata data
  ) external returns (bool success);

  function transferFrom(
    address from,
    address to,
    uint256 value
  ) external returns (bool success);
}

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

interface VRFCoordinatorV2Interface {
  /**
   * @notice Get configuration relevant for making requests
   * @return minimumRequestConfirmations global min for request confirmations
   * @return maxGasLimit global max for request gas limit
   * @return s_provingKeyHashes list of registered key hashes
   */
  function getRequestConfig()
    external
    view
    returns (
      uint16,
      uint32,
      bytes32[] memory
    );

  /**
   * @notice Request a set of random words.
   * @param keyHash - Corresponds to a particular oracle job which uses
   * that key for generating the VRF proof. Different keyHash's have different gas price
   * ceilings, so you can select a specific one to bound your maximum per request cost.
   * @param subId  - The ID of the VRF subscription. Must be funded
   * with the minimum subscription balance required for the selected keyHash.
   * @param minimumRequestConfirmations - How many blocks you'd like the
   * oracle to wait before responding to the request. See SECURITY CONSIDERATIONS
   * for why you may want to request more. The acceptable range is
   * [minimumRequestBlockConfirmations, 200].
   * @param callbackGasLimit - How much gas you'd like to receive in your
   * fulfillRandomWords callback. Note that gasleft() inside fulfillRandomWords
   * may be slightly less than this amount because of gas used calling the function
   * (argument decoding etc.), so you may need to request slightly more than you expect
   * to have inside fulfillRandomWords. The acceptable range is
   * [0, maxGasLimit]
   * @param numWords - The number of uint256 random values you'd like to receive
   * in your fulfillRandomWords callback. Note these numbers are expanded in a
   * secure way by the VRFCoordinator from a single random value supplied by the oracle.
   * @return requestId - A unique identifier of the request. Can be used to match
   * a request to a response in fulfillRandomWords.
   */
  function requestRandomWords(
    bytes32 keyHash,
    uint64 subId,
    uint16 minimumRequestConfirmations,
    uint32 callbackGasLimit,
    uint32 numWords
  ) external returns (uint256 requestId);

  /**
   * @notice Create a VRF subscription.
   * @return subId - A unique subscription id.
   * @dev You can manage the consumer set dynamically with addConsumer/removeConsumer.
   * @dev Note to fund the subscription, use transferAndCall. For example
   * @dev  LINKTOKEN.transferAndCall(
   * @dev    address(COORDINATOR),
   * @dev    amount,
   * @dev    abi.encode(subId));
   */
  function createSubscription() external returns (uint64 subId);

  /**
   * @notice Get a VRF subscription.
   * @param subId - ID of the subscription
   * @return balance - LINK balance of the subscription in juels.
   * @return reqCount - number of requests for this subscription, determines fee tier.
   * @return owner - owner of the subscription.
   * @return consumers - list of consumer address which are able to use this subscription.
   */
  function getSubscription(uint64 subId)
    external
    view
    returns (
      uint96 balance,
      uint64 reqCount,
      address owner,
      address[] memory consumers
    );

  /**
   * @notice Request subscription owner transfer.
   * @param subId - ID of the subscription
   * @param newOwner - proposed new owner of the subscription
   */
  function requestSubscriptionOwnerTransfer(uint64 subId, address newOwner) external;

  /**
   * @notice Request subscription owner transfer.
   * @param subId - ID of the subscription
   * @dev will revert if original owner of subId has
   * not requested that msg.sender become the new owner.
   */
  function acceptSubscriptionOwnerTransfer(uint64 subId) external;

  /**
   * @notice Add a consumer to a VRF subscription.
   * @param subId - ID of the subscription
   * @param consumer - New consumer which can use the subscription
   */
  function addConsumer(uint64 subId, address consumer) external;

  /**
   * @notice Remove a consumer from a VRF subscription.
   * @param subId - ID of the subscription
   * @param consumer - Consumer to remove from the subscription
   */
  function removeConsumer(uint64 subId, address consumer) external;

  /**
   * @notice Cancel a subscription
   * @param subId - ID of the subscription
   * @param to - Where to send the remaining LINK to
   */
  function cancelSubscription(uint64 subId, address to) external;
}

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

/** ****************************************************************************
 * @notice Interface for contracts using VRF randomness
 * *****************************************************************************
 * @dev PURPOSE
 *
 * @dev Reggie the Random Oracle (not his real job) wants to provide randomness
 * @dev to Vera the verifier in such a way that Vera can be sure he's not
 * @dev making his output up to suit himself. Reggie provides Vera a public key
 * @dev to which he knows the secret key. Each time Vera provides a seed to
 * @dev Reggie, he gives back a value which is computed completely
 * @dev deterministically from the seed and the secret key.
 *
 * @dev Reggie provides a proof by which Vera can verify that the output was
 * @dev correctly computed once Reggie tells it to her, but without that proof,
 * @dev the output is indistinguishable to her from a uniform random sample
 * @dev from the output space.
 *
 * @dev The purpose of this contract is to make it easy for unrelated contracts
 * @dev to talk to Vera the verifier about the work Reggie is doing, to provide
 * @dev simple access to a verifiable source of randomness. It ensures 2 things:
 * @dev 1. The fulfillment came from the VRFCoordinator
 * @dev 2. The consumer contract implements fulfillRandomWords.
 * *****************************************************************************
 * @dev USAGE
 *
 * @dev Calling contracts must inherit from VRFConsumerBase, and can
 * @dev initialize VRFConsumerBase's attributes in their constructor as
 * @dev shown:
 *
 * @dev   contract VRFConsumer {
 * @dev     constructor(<other arguments>, address _vrfCoordinator, address _link)
 * @dev       VRFConsumerBase(_vrfCoordinator) public {
 * @dev         <initialization with other arguments goes here>
 * @dev       }
 * @dev   }
 *
 * @dev The oracle will have given you an ID for the VRF keypair they have
 * @dev committed to (let's call it keyHash). Create subscription, fund it
 * @dev and your consumer contract as a consumer of it (see VRFCoordinatorInterface
 * @dev subscription management functions).
 * @dev Call requestRandomWords(keyHash, subId, minimumRequestConfirmations,
 * @dev callbackGasLimit, numWords),
 * @dev see (VRFCoordinatorInterface for a description of the arguments).
 *
 * @dev Once the VRFCoordinator has received and validated the oracle's response
 * @dev to your request, it will call your contract's fulfillRandomWords method.
 *
 * @dev The randomness argument to fulfillRandomWords is a set of random words
 * @dev generated from your requestId and the blockHash of the request.
 *
 * @dev If your contract could have concurrent requests open, you can use the
 * @dev requestId returned from requestRandomWords to track which response is associated
 * @dev with which randomness request.
 * @dev See "SECURITY CONSIDERATIONS" for principles to keep in mind,
 * @dev if your contract could have multiple requests in flight simultaneously.
 *
 * @dev Colliding `requestId`s are cryptographically impossible as long as seeds
 * @dev differ.
 *
 * *****************************************************************************
 * @dev SECURITY CONSIDERATIONS
 *
 * @dev A method with the ability to call your fulfillRandomness method directly
 * @dev could spoof a VRF response with any random value, so it's critical that
 * @dev it cannot be directly called by anything other than this base contract
 * @dev (specifically, by the VRFConsumerBase.rawFulfillRandomness method).
 *
 * @dev For your users to trust that your contract's random behavior is free
 * @dev from malicious interference, it's best if you can write it so that all
 * @dev behaviors implied by a VRF response are executed *during* your
 * @dev fulfillRandomness method. If your contract must store the response (or
 * @dev anything derived from it) and use it later, you must ensure that any
 * @dev user-significant behavior which depends on that stored value cannot be
 * @dev manipulated by a subsequent VRF request.
 *
 * @dev Similarly, both miners and the VRF oracle itself have some influence
 * @dev over the order in which VRF responses appear on the blockchain, so if
 * @dev your contract could have multiple VRF requests in flight simultaneously,
 * @dev you must ensure that the order in which the VRF responses arrive cannot
 * @dev be used to manipulate your contract's user-significant behavior.
 *
 * @dev Since the block hash of the block which contains the requestRandomness
 * @dev call is mixed into the input to the VRF *last*, a sufficiently powerful
 * @dev miner could, in principle, fork the blockchain to evict the block
 * @dev containing the request, forcing the request to be included in a
 * @dev different block with a different hash, and therefore a different input
 * @dev to the VRF. However, such an attack would incur a substantial economic
 * @dev cost. This cost scales with the number of blocks the VRF oracle waits
 * @dev until it calls responds to a request. It is for this reason that
 * @dev that you can signal to an oracle you'd like them to wait longer before
 * @dev responding to the request (however this is not enforced in the contract
 * @dev and so remains effective only in the case of unmodified oracle software).
 */
abstract contract VRFConsumerBaseV2 {
  error OnlyCoordinatorCanFulfill(address have, address want);
  address private immutable vrfCoordinator;

  /**
   * @param _vrfCoordinator address of VRFCoordinator contract
   */
  constructor(address _vrfCoordinator) {
    vrfCoordinator = _vrfCoordinator;
  }

  /**
   * @notice fulfillRandomness handles the VRF response. Your contract must
   * @notice implement it. See "SECURITY CONSIDERATIONS" above for important
   * @notice principles to keep in mind when implementing your fulfillRandomness
   * @notice method.
   *
   * @dev VRFConsumerBaseV2 expects its subcontracts to have a method with this
   * @dev signature, and will call it once it has verified the proof
   * @dev associated with the randomness. (It is triggered via a call to
   * @dev rawFulfillRandomness, below.)
   *
   * @param requestId The Id initially returned by requestRandomness
   * @param randomWords the VRF output expanded to the requested number of words
   */
  function fulfillRandomWords(uint256 requestId, uint256[] memory randomWords) internal virtual;

  // rawFulfillRandomness is called by VRFCoordinator when it receives a valid VRF
  // proof. rawFulfillRandomness then calls fulfillRandomness, after validating
  // the origin of the call
  function rawFulfillRandomWords(uint256 requestId, uint256[] memory randomWords) external {
    if (msg.sender != vrfCoordinator) {
      revert OnlyCoordinatorCanFulfill(msg.sender, vrfCoordinator);
    }
    fulfillRandomWords(requestId, randomWords);
  }
}

File 7 of 10 : IAccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

File 8 of 10 : 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 9 of 10 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

File 11 of 10 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"have","type":"address"},{"internalType":"address","name":"want","type":"address"}],"name":"OnlyCoordinatorCanFulfill","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RANDOM_REQUESTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"consumerAddress","type":"address"}],"name":"addConsumer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"callbackGasLimit","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"receivingWallet","type":"address"}],"name":"cancelSubscription","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_chainId","type":"uint32"},{"internalType":"address","name":"_contractAddress","type":"address"}],"name":"chainIdAddressToUint256","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"createNewSubscription","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"projectNameString","type":"string"}],"name":"getRandomNumber","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"projectNameString","type":"string"}],"name":"getScheduleRequest","outputs":[{"components":[{"internalType":"uint48","name":"requestTime","type":"uint48"},{"internalType":"uint48","name":"scheduledTime","type":"uint48"},{"internalType":"uint48","name":"fullFilledTime","type":"uint48"},{"internalType":"uint256","name":"requestId","type":"uint256"},{"internalType":"uint256","name":"randomNumber","type":"uint256"}],"internalType":"struct RandomSeed.RandomRequest","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"keyHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"link_token_contract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numWords","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"randomRequests","outputs":[{"internalType":"uint48","name":"requestTime","type":"uint48"},{"internalType":"uint48","name":"scheduledTime","type":"uint48"},{"internalType":"uint48","name":"fullFilledTime","type":"uint48"},{"internalType":"uint256","name":"requestId","type":"uint256"},{"internalType":"uint256","name":"randomNumber","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"randomRequestsList","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"requestId","type":"uint256"},{"internalType":"uint256[]","name":"randomWords","type":"uint256[]"}],"name":"rawFulfillRandomWords","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"consumerAddress","type":"address"}],"name":"removeConsumer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"requestConfirmations","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"requestId_to_contract","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"projectNameString","type":"string"}],"name":"requestRandomWords","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"s_subscriptionId","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_keyHash","type":"bytes32"}],"name":"setKeyHash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"_s_subscriptionId","type":"uint64"}],"name":"setSubscriptionId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"projectNameString","type":"string"}],"name":"stringToBytes32","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"topUpSubscription","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vrfCoordinator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60a06040527f8af398995b04c28e9951adb9721ef74c74f93e6a478f39e7e0777be13527e7ef6003553480156200003557600080fd5b5073271682deb8c4e0901d1a1550ad2e64d568e699096080526200005b600033620000d5565b620000877fd51ceac178b03cb5d6683c46fba190997c1489058e7e4d7e7878c128a7ed86a033620000d5565b600180546001600160a01b031990811673271682deb8c4e0901d1a1550ad2e64d568e69909179091556002805490911673514910771af9ca656af840dff83e8264ecf986ca17905562000185565b620000e18282620000e5565b5050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16620000e1576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620001413390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60805161178d620001a86000396000818161079001526107d2015261178d6000f3fe608060405234801561001057600080fd5b50600436106101ef5760003560e01c80637ccfd7fc1161010f578063a3e56fa8116100a2578063d305843c11610071578063d305843c14610544578063d547741f14610557578063ea3bc9a81461056a578063ea7b4f771461059457600080fd5b8063a3e56fa8146104e8578063b0fb162f14610503578063cb4060171461051e578063cfb519281461053157600080fd5b806393d81d58116100de57806393d81d58146104a757806397016350146104ba57806398544710146104cd578063a217fddf146104e057600080fd5b80637ccfd7fc1461044e57806386850e93146104565780638ac000211461046957806391d148541461049457600080fd5b80632f2ff15d116101875780635d1d5173116101565780635d1d5173146103f657806361728f39146104165780636d0c4e291461041f578063760924a11461042757600080fd5b80632f2ff15d146103415780633633aa751461035457806336568abe14610387578063382952851461039a57600080fd5b8063112940f9116101c3578063112940f9146102cb5780631fe543e3146102de578063248a9ca3146102f157806324f746971461032257600080fd5b8062f714ce146101f457806301ffc9a7146102095780630b414d90146102315780630e27e3df146102b8575b600080fd5b61020761020236600461129e565b6105a7565b005b61021c6102173660046112ca565b610653565b60405190151581526020015b60405180910390f35b61028061023f3660046112f4565b60056020526000908152604090208054600182015460029092015465ffffffffffff8083169366010000000000008404821693600160601b90049091169185565b6040805165ffffffffffff9687168152948616602086015292909416918301919091526060820152608081019190915260a001610228565b6102076102c636600461130d565b61068a565b6102076102d936600461130d565b610722565b6102076102ec36600461136e565b610785565b6103146102ff3660046112f4565b60009081526020819052604090206001015490565b604051908152602001610228565b61032c620186a081565b60405163ffffffff9091168152602001610228565b61020761034f36600461129e565b61080d565b61036f73514910771af9ca656af840dff83e8264ecf986ca81565b6040516001600160a01b039091168152602001610228565b61020761039536600461129e565b610832565b6103ad6103a836600461141f565b6108ac565b60408051825165ffffffffffff9081168252602080850151821690830152838301511691810191909152606080830151908201526080918201519181019190915260a001610228565b6103146104043660046112f4565b60066020526000908152604090205481565b61031460035481565b610207610948565b6103147fd51ceac178b03cb5d6683c46fba190997c1489058e7e4d7e7878c128a7ed86a081565b61032c600181565b6102076104643660046112f4565b610a91565b60045461047c906001600160401b031681565b6040516001600160401b039091168152602001610228565b61021c6104a236600461129e565b610b5c565b6102076104b536600461130d565b610b85565b6103146104c83660046112f4565b610c2e565b6102076104db3660046112f4565b610c4f565b610314600081565b61036f73271682deb8c4e0901d1a1550ad2e64d568e6990981565b61050b600381565b60405161ffff9091168152602001610228565b61020761052c36600461141f565b610c7b565b61031461053f36600461141f565b610e7f565b61031461055236600461141f565b610e8a565b61020761056536600461129e565b610eaf565b6103146105783660046114b3565b6001600160a01b031660a09190911b63ffffffff60a01b161790565b6102076105a23660046114fd565b610ed4565b6105b2600033610b5c565b6105d75760405162461bcd60e51b81526004016105ce9061151a565b60405180910390fd5b60025460405163a9059cbb60e01b81526001600160a01b038381166004830152602482018590529091169063a9059cbb906044016020604051808303816000875af115801561062a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064e9190611551565b505050565b60006001600160e01b03198216637965db0b60e01b148061068457506301ffc9a760e01b6001600160e01b03198316145b92915050565b610695600033610b5c565b6106b15760405162461bcd60e51b81526004016105ce9061151a565b60015460048054604051639f87fad760e01b81526001600160a01b0390931692639f87fad7926106ed926001600160401b031691869101611573565b600060405180830381600087803b15801561070757600080fd5b505af115801561071b573d6000803e3d6000fd5b5050505050565b61072d600033610b5c565b6107495760405162461bcd60e51b81526004016105ce9061151a565b60015460048054604051631cd0704360e21b81526001600160a01b0390931692637341c10c926106ed926001600160401b031691869101611573565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146107ff5760405163073e64fd60e21b81523360048201526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001660248201526044016105ce565b6108098282610f1e565b5050565b60008281526020819052604090206001015461082881610f86565b61064e8383610f93565b6001600160a01b03811633146108a25760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016105ce565b6108098282611017565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101829052906108e083610e7f565b600090815260056020908152604091829020825160a081018452815465ffffffffffff808216835266010000000000008204811694830194909452600160601b9004909216928201929092526001820154606082015260029091015460808201529392505050565b610953600033610b5c565b61096f5760405162461bcd60e51b81526004016105ce9061151a565b6040805160018082528183019092526000916020808301908036833701905050905030816000815181106109a5576109a5611595565b6001600160a01b039283166020918202929092018101919091526001546040805163288688f960e21b81529051919093169263a21a23e492600480830193919282900301816000875af1158015610a00573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a2491906115ab565b6004805467ffffffffffffffff19166001600160401b0392909216918217905560015482516001600160a01b0390911691637341c10c918490600090610a6c57610a6c611595565b60200260200101516040518363ffffffff1660e01b81526004016106ed929190611573565b610a9c600033610b5c565b610ab85760405162461bcd60e51b81526004016105ce9061151a565b600254600154600454604080516001600160401b0390921660208301526001600160a01b0393841693634000aea09316918591016040516020818303038152906040526040518463ffffffff1660e01b8152600401610b1993929190611624565b6020604051808303816000875af1158015610b38573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108099190611551565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b610b90600033610b5c565b610bac5760405162461bcd60e51b81526004016105ce9061151a565b60015460048054604051630d7ae1d360e41b81526001600160a01b039093169263d7ae1d3092610be8926001600160401b031691869101611573565b600060405180830381600087803b158015610c0257600080fd5b505af1158015610c16573d6000803e3d6000fd5b50506004805467ffffffffffffffff19169055505050565b60078181548110610c3e57600080fd5b600091825260209091200154905081565b610c5a600033610b5c565b610c765760405162461bcd60e51b81526004016105ce9061151a565b600355565b610ca57fd51ceac178b03cb5d6683c46fba190997c1489058e7e4d7e7878c128a7ed86a033610b5c565b610cfc5760405162461bcd60e51b815260206004820152602260248201527f63616c6c657220686173206e6f742052616e646f6d526571756573746572526f6044820152616c6560f01b60648201526084016105ce565b6000610d0782610e7f565b60008181526005602052604090206001015490915015610d695760405162461bcd60e51b815260206004820152601f60248201527f72616e646f6d206e756d62657220616c7265616479207265717565737465640060448201526064016105ce565b6001805460038054600480546040516305d3b1d360e41b8152918201929092526001600160401b0390911660248201526044810191909152620186a0606482015260848101929092526000916001600160a01b0390911690635d3b1d309060a4016020604051808303816000875af1158015610de9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0d9190611654565b6000838152600560209081526040808320805465ffffffffffff19164265ffffffffffff1617815560019081018590559383526006909152812084905560078054928301815590527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68801919091555050565b60006106848261166d565b600080610e9683610e7f565b6000908152600560205260409020600201549392505050565b600082815260208190526040902060010154610eca81610f86565b61064e8383611017565b610edf600033610b5c565b610efb5760405162461bcd60e51b81526004016105ce9061151a565b6004805467ffffffffffffffff19166001600160401b0392909216919091179055565b600082815260066020526040812054825190918391610f3f57610f3f611595565b6020908102919091018101516000928352600590915260409091206002810191909155805465ffffffffffff60601b1916600160601b4265ffffffffffff16021790555050565b610f90813361107c565b50565b610f9d8282610b5c565b610809576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055610fd33390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6110218282610b5c565b15610809576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6110868282610b5c565b6108095761109e816001600160a01b031660146110e0565b6110a98360206110e0565b6040516020016110ba929190611694565b60408051601f198184030181529082905262461bcd60e51b82526105ce91600401611709565b606060006110ef836002611732565b6110fa906002611751565b6001600160401b0381111561111157611111611328565b6040519080825280601f01601f19166020018201604052801561113b576020820181803683370190505b509050600360fc1b8160008151811061115657611156611595565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061118557611185611595565b60200101906001600160f81b031916908160001a90535060006111a9846002611732565b6111b4906001611751565b90505b600181111561122c576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106111e8576111e8611595565b1a60f81b8282815181106111fe576111fe611595565b60200101906001600160f81b031916908160001a90535060049490941c9361122581611769565b90506111b7565b50831561127b5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016105ce565b9392505050565b80356001600160a01b038116811461129957600080fd5b919050565b600080604083850312156112b157600080fd5b823591506112c160208401611282565b90509250929050565b6000602082840312156112dc57600080fd5b81356001600160e01b03198116811461127b57600080fd5b60006020828403121561130657600080fd5b5035919050565b60006020828403121561131f57600080fd5b61127b82611282565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561136657611366611328565b604052919050565b6000806040838503121561138157600080fd5b823591506020808401356001600160401b03808211156113a057600080fd5b818601915086601f8301126113b457600080fd5b8135818111156113c6576113c6611328565b8060051b91506113d784830161133e565b81815291830184019184810190898411156113f157600080fd5b938501935b8385101561140f578435825293850193908501906113f6565b8096505050505050509250929050565b6000602080838503121561143257600080fd5b82356001600160401b038082111561144957600080fd5b818501915085601f83011261145d57600080fd5b81358181111561146f5761146f611328565b611481601f8201601f1916850161133e565b9150808252868482850101111561149757600080fd5b8084840185840137600090820190930192909252509392505050565b600080604083850312156114c657600080fd5b823563ffffffff811681146114da57600080fd5b91506112c160208401611282565b6001600160401b0381168114610f9057600080fd5b60006020828403121561150f57600080fd5b813561127b816114e8565b60208082526019908201527f63616c6c657220686173206e6f742061646d696e20726f6c6500000000000000604082015260600190565b60006020828403121561156357600080fd5b8151801515811461127b57600080fd5b6001600160401b039290921682526001600160a01b0316602082015260400190565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156115bd57600080fd5b815161127b816114e8565b60005b838110156115e35781810151838201526020016115cb565b838111156115f2576000848401525b50505050565b600081518084526116108160208601602086016115c8565b601f01601f19169290920160200192915050565b60018060a01b038416815282602082015260606040820152600061164b60608301846115f8565b95945050505050565b60006020828403121561166657600080fd5b5051919050565b8051602080830151919081101561168e576000198160200360031b1b821691505b50919050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516116cc8160178501602088016115c8565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516116fd8160288401602088016115c8565b01602801949350505050565b60208152600061127b60208301846115f8565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561174c5761174c61171c565b500290565b600082198211156117645761176461171c565b500190565b6000816117785761177861171c565b50600019019056fea164736f6c634300080f000a

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101ef5760003560e01c80637ccfd7fc1161010f578063a3e56fa8116100a2578063d305843c11610071578063d305843c14610544578063d547741f14610557578063ea3bc9a81461056a578063ea7b4f771461059457600080fd5b8063a3e56fa8146104e8578063b0fb162f14610503578063cb4060171461051e578063cfb519281461053157600080fd5b806393d81d58116100de57806393d81d58146104a757806397016350146104ba57806398544710146104cd578063a217fddf146104e057600080fd5b80637ccfd7fc1461044e57806386850e93146104565780638ac000211461046957806391d148541461049457600080fd5b80632f2ff15d116101875780635d1d5173116101565780635d1d5173146103f657806361728f39146104165780636d0c4e291461041f578063760924a11461042757600080fd5b80632f2ff15d146103415780633633aa751461035457806336568abe14610387578063382952851461039a57600080fd5b8063112940f9116101c3578063112940f9146102cb5780631fe543e3146102de578063248a9ca3146102f157806324f746971461032257600080fd5b8062f714ce146101f457806301ffc9a7146102095780630b414d90146102315780630e27e3df146102b8575b600080fd5b61020761020236600461129e565b6105a7565b005b61021c6102173660046112ca565b610653565b60405190151581526020015b60405180910390f35b61028061023f3660046112f4565b60056020526000908152604090208054600182015460029092015465ffffffffffff8083169366010000000000008404821693600160601b90049091169185565b6040805165ffffffffffff9687168152948616602086015292909416918301919091526060820152608081019190915260a001610228565b6102076102c636600461130d565b61068a565b6102076102d936600461130d565b610722565b6102076102ec36600461136e565b610785565b6103146102ff3660046112f4565b60009081526020819052604090206001015490565b604051908152602001610228565b61032c620186a081565b60405163ffffffff9091168152602001610228565b61020761034f36600461129e565b61080d565b61036f73514910771af9ca656af840dff83e8264ecf986ca81565b6040516001600160a01b039091168152602001610228565b61020761039536600461129e565b610832565b6103ad6103a836600461141f565b6108ac565b60408051825165ffffffffffff9081168252602080850151821690830152838301511691810191909152606080830151908201526080918201519181019190915260a001610228565b6103146104043660046112f4565b60066020526000908152604090205481565b61031460035481565b610207610948565b6103147fd51ceac178b03cb5d6683c46fba190997c1489058e7e4d7e7878c128a7ed86a081565b61032c600181565b6102076104643660046112f4565b610a91565b60045461047c906001600160401b031681565b6040516001600160401b039091168152602001610228565b61021c6104a236600461129e565b610b5c565b6102076104b536600461130d565b610b85565b6103146104c83660046112f4565b610c2e565b6102076104db3660046112f4565b610c4f565b610314600081565b61036f73271682deb8c4e0901d1a1550ad2e64d568e6990981565b61050b600381565b60405161ffff9091168152602001610228565b61020761052c36600461141f565b610c7b565b61031461053f36600461141f565b610e7f565b61031461055236600461141f565b610e8a565b61020761056536600461129e565b610eaf565b6103146105783660046114b3565b6001600160a01b031660a09190911b63ffffffff60a01b161790565b6102076105a23660046114fd565b610ed4565b6105b2600033610b5c565b6105d75760405162461bcd60e51b81526004016105ce9061151a565b60405180910390fd5b60025460405163a9059cbb60e01b81526001600160a01b038381166004830152602482018590529091169063a9059cbb906044016020604051808303816000875af115801561062a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064e9190611551565b505050565b60006001600160e01b03198216637965db0b60e01b148061068457506301ffc9a760e01b6001600160e01b03198316145b92915050565b610695600033610b5c565b6106b15760405162461bcd60e51b81526004016105ce9061151a565b60015460048054604051639f87fad760e01b81526001600160a01b0390931692639f87fad7926106ed926001600160401b031691869101611573565b600060405180830381600087803b15801561070757600080fd5b505af115801561071b573d6000803e3d6000fd5b5050505050565b61072d600033610b5c565b6107495760405162461bcd60e51b81526004016105ce9061151a565b60015460048054604051631cd0704360e21b81526001600160a01b0390931692637341c10c926106ed926001600160401b031691869101611573565b336001600160a01b037f000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e6990916146107ff5760405163073e64fd60e21b81523360048201526001600160a01b037f000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e699091660248201526044016105ce565b6108098282610f1e565b5050565b60008281526020819052604090206001015461082881610f86565b61064e8383610f93565b6001600160a01b03811633146108a25760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016105ce565b6108098282611017565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101829052906108e083610e7f565b600090815260056020908152604091829020825160a081018452815465ffffffffffff808216835266010000000000008204811694830194909452600160601b9004909216928201929092526001820154606082015260029091015460808201529392505050565b610953600033610b5c565b61096f5760405162461bcd60e51b81526004016105ce9061151a565b6040805160018082528183019092526000916020808301908036833701905050905030816000815181106109a5576109a5611595565b6001600160a01b039283166020918202929092018101919091526001546040805163288688f960e21b81529051919093169263a21a23e492600480830193919282900301816000875af1158015610a00573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a2491906115ab565b6004805467ffffffffffffffff19166001600160401b0392909216918217905560015482516001600160a01b0390911691637341c10c918490600090610a6c57610a6c611595565b60200260200101516040518363ffffffff1660e01b81526004016106ed929190611573565b610a9c600033610b5c565b610ab85760405162461bcd60e51b81526004016105ce9061151a565b600254600154600454604080516001600160401b0390921660208301526001600160a01b0393841693634000aea09316918591016040516020818303038152906040526040518463ffffffff1660e01b8152600401610b1993929190611624565b6020604051808303816000875af1158015610b38573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108099190611551565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b610b90600033610b5c565b610bac5760405162461bcd60e51b81526004016105ce9061151a565b60015460048054604051630d7ae1d360e41b81526001600160a01b039093169263d7ae1d3092610be8926001600160401b031691869101611573565b600060405180830381600087803b158015610c0257600080fd5b505af1158015610c16573d6000803e3d6000fd5b50506004805467ffffffffffffffff19169055505050565b60078181548110610c3e57600080fd5b600091825260209091200154905081565b610c5a600033610b5c565b610c765760405162461bcd60e51b81526004016105ce9061151a565b600355565b610ca57fd51ceac178b03cb5d6683c46fba190997c1489058e7e4d7e7878c128a7ed86a033610b5c565b610cfc5760405162461bcd60e51b815260206004820152602260248201527f63616c6c657220686173206e6f742052616e646f6d526571756573746572526f6044820152616c6560f01b60648201526084016105ce565b6000610d0782610e7f565b60008181526005602052604090206001015490915015610d695760405162461bcd60e51b815260206004820152601f60248201527f72616e646f6d206e756d62657220616c7265616479207265717565737465640060448201526064016105ce565b6001805460038054600480546040516305d3b1d360e41b8152918201929092526001600160401b0390911660248201526044810191909152620186a0606482015260848101929092526000916001600160a01b0390911690635d3b1d309060a4016020604051808303816000875af1158015610de9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0d9190611654565b6000838152600560209081526040808320805465ffffffffffff19164265ffffffffffff1617815560019081018590559383526006909152812084905560078054928301815590527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68801919091555050565b60006106848261166d565b600080610e9683610e7f565b6000908152600560205260409020600201549392505050565b600082815260208190526040902060010154610eca81610f86565b61064e8383611017565b610edf600033610b5c565b610efb5760405162461bcd60e51b81526004016105ce9061151a565b6004805467ffffffffffffffff19166001600160401b0392909216919091179055565b600082815260066020526040812054825190918391610f3f57610f3f611595565b6020908102919091018101516000928352600590915260409091206002810191909155805465ffffffffffff60601b1916600160601b4265ffffffffffff16021790555050565b610f90813361107c565b50565b610f9d8282610b5c565b610809576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055610fd33390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6110218282610b5c565b15610809576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6110868282610b5c565b6108095761109e816001600160a01b031660146110e0565b6110a98360206110e0565b6040516020016110ba929190611694565b60408051601f198184030181529082905262461bcd60e51b82526105ce91600401611709565b606060006110ef836002611732565b6110fa906002611751565b6001600160401b0381111561111157611111611328565b6040519080825280601f01601f19166020018201604052801561113b576020820181803683370190505b509050600360fc1b8160008151811061115657611156611595565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061118557611185611595565b60200101906001600160f81b031916908160001a90535060006111a9846002611732565b6111b4906001611751565b90505b600181111561122c576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106111e8576111e8611595565b1a60f81b8282815181106111fe576111fe611595565b60200101906001600160f81b031916908160001a90535060049490941c9361122581611769565b90506111b7565b50831561127b5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016105ce565b9392505050565b80356001600160a01b038116811461129957600080fd5b919050565b600080604083850312156112b157600080fd5b823591506112c160208401611282565b90509250929050565b6000602082840312156112dc57600080fd5b81356001600160e01b03198116811461127b57600080fd5b60006020828403121561130657600080fd5b5035919050565b60006020828403121561131f57600080fd5b61127b82611282565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561136657611366611328565b604052919050565b6000806040838503121561138157600080fd5b823591506020808401356001600160401b03808211156113a057600080fd5b818601915086601f8301126113b457600080fd5b8135818111156113c6576113c6611328565b8060051b91506113d784830161133e565b81815291830184019184810190898411156113f157600080fd5b938501935b8385101561140f578435825293850193908501906113f6565b8096505050505050509250929050565b6000602080838503121561143257600080fd5b82356001600160401b038082111561144957600080fd5b818501915085601f83011261145d57600080fd5b81358181111561146f5761146f611328565b611481601f8201601f1916850161133e565b9150808252868482850101111561149757600080fd5b8084840185840137600090820190930192909252509392505050565b600080604083850312156114c657600080fd5b823563ffffffff811681146114da57600080fd5b91506112c160208401611282565b6001600160401b0381168114610f9057600080fd5b60006020828403121561150f57600080fd5b813561127b816114e8565b60208082526019908201527f63616c6c657220686173206e6f742061646d696e20726f6c6500000000000000604082015260600190565b60006020828403121561156357600080fd5b8151801515811461127b57600080fd5b6001600160401b039290921682526001600160a01b0316602082015260400190565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156115bd57600080fd5b815161127b816114e8565b60005b838110156115e35781810151838201526020016115cb565b838111156115f2576000848401525b50505050565b600081518084526116108160208601602086016115c8565b601f01601f19169290920160200192915050565b60018060a01b038416815282602082015260606040820152600061164b60608301846115f8565b95945050505050565b60006020828403121561166657600080fd5b5051919050565b8051602080830151919081101561168e576000198160200360031b1b821691505b50919050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516116cc8160178501602088016115c8565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516116fd8160288401602088016115c8565b01602801949350505050565b60208152600061127b60208301846115f8565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561174c5761174c61171c565b500290565b600082198211156117645761176461171c565b500190565b6000816117785761177861171c565b50600019019056fea164736f6c634300080f000a

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Txn 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.