ETH Price: $3,260.63 (-0.54%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Start Reveal153278302022-08-12 15:41:07895 days ago1660318867IN
0xCaEdF383...aaF36fdFc
0 ETH0.0027069224.10121529

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
$8liensVRFHandler

Compiler Version
v0.8.12+commit.f00d7308

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license
File 1 of 5 : 8liensVRFHandler.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;

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

/// @title 8liensVRFHandler
/// @author 8liens (https://twitter.com/8liensNFT)
/// @author Developer: dievardump (https://twitter.com/dievardump, [email protected])
contract $8liensVRFHandler is Ownable, VRFHandler {
    error SeedInRequest();
    error SeedExists();

    string public constant name = "8liens Magic";

    uint256 public seed;

    uint256 public requestId;

    /////////////////////////////////////////////////////////
    // Gated Owner                                         //
    /////////////////////////////////////////////////////////

    /// @notice Allows owner to start the reveal process by getting a seed
    /// @param vrfConfig the config to use with ChainLink
    function startReveal(VRFConfig memory vrfConfig) external onlyOwner {
        if (seed != 0) {
            revert SeedExists();
        }

        if (requestId != 0) {
            revert SeedInRequest();
        }

        requestId = _requestRandomWords(vrfConfig);
    }

    /////////////////////////////////////////////////////////
    // Internals                                           //
    /////////////////////////////////////////////////////////

    /// @dev needs to be overrode in the consumer contract
    function _fulfillRandomWords(
        uint256, /* requestId */
        uint256[] memory words
    ) internal virtual override {
        seed = words[0];
    }
}

File 2 of 5 : 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 3 of 5 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 4 of 5 : 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 5 of 5 : VRFHandler.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;

import {VRFCoordinatorV2Interface} from "@chainlink/contracts/src/v0.8/interfaces/VRFCoordinatorV2Interface.sol";

/// @title VRFHandler
/// @author Developer: dievardump (https://twitter.com/dievardump, [email protected])
contract VRFHandler {
    error OnlyCoordinatorCanFulfill(address have, address want);

    struct VRFConfig {
        bytes32 keyHash;
        address coordinator;
        uint64 subscriptionId;
        uint32 callbackGasLimit;
        uint16 requestConfirmations;
        uint32 numWords;
    }

    /// @notice ChainLink request id to coordinator
    mapping(uint256 => address) public requestIdCoordinator;

    /////////////////////////////////////////////////////////
    // Gated Coordinator                                   //
    /////////////////////////////////////////////////////////

    // 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 != requestIdCoordinator[requestId]) {
            revert OnlyCoordinatorCanFulfill(
                msg.sender,
                requestIdCoordinator[requestId]
            );
        }

        _fulfillRandomWords(requestId, randomWords);
    }

    /////////////////////////////////////////////////////////
    // Internal                                            //
    /////////////////////////////////////////////////////////

    /// @dev basic call using the vrfConfig
    /// @param vrfConfig the VRF call configuration
    function _requestRandomWords(VRFConfig memory vrfConfig)
        internal
        virtual
        returns (uint256)
    {
        // Will revert if subscription is not set and funded.
        uint256 requestId = VRFCoordinatorV2Interface(vrfConfig.coordinator)
            .requestRandomWords(
                vrfConfig.keyHash,
                vrfConfig.subscriptionId,
                vrfConfig.requestConfirmations,
                vrfConfig.callbackGasLimit,
                vrfConfig.numWords
            );

        requestIdCoordinator[requestId] = vrfConfig.coordinator;

        return requestId;
    }

    /// @notice fulfillRandomness handles the VRF response.
    /// @dev this method will be called by rawFulfillRandomWords after checking caller
    /// @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
    ) internal virtual {}
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"have","type":"address"},{"internalType":"address","name":"want","type":"address"}],"name":"OnlyCoordinatorCanFulfill","type":"error"},{"inputs":[],"name":"SeedExists","type":"error"},{"inputs":[],"name":"SeedInRequest","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"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":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"requestId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"requestIdCoordinator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"seed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32","name":"keyHash","type":"bytes32"},{"internalType":"address","name":"coordinator","type":"address"},{"internalType":"uint64","name":"subscriptionId","type":"uint64"},{"internalType":"uint32","name":"callbackGasLimit","type":"uint32"},{"internalType":"uint16","name":"requestConfirmations","type":"uint16"},{"internalType":"uint32","name":"numWords","type":"uint32"}],"internalType":"struct VRFHandler.VRFConfig","name":"vrfConfig","type":"tuple"}],"name":"startReveal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b5061001a3361001f565b61006f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61076e8061007e6000396000f3fe608060405234801561001057600080fd5b50600436106100925760003560e01c8063715018a611610066578063715018a6146101135780637d94792a1461011b5780638da5cb5b14610124578063ab0e8a0f14610149578063f2fde38b1461017257600080fd5b80626d6cae1461009757806306fdde03146100b35780631fe543e3146100eb578063231fff1414610100575b600080fd5b6100a060035481565b6040519081526020015b60405180910390f35b6100de6040518060400160405280600c81526020016b386c69656e73204d6167696360a01b81525081565b6040516100aa919061049a565b6100fe6100f9366004610536565b610185565b005b6100fe61010e36600461062a565b6101f1565b6100fe61024a565b6100a060025481565b6000546001600160a01b03165b6040516001600160a01b0390911681526020016100aa565b6101316101573660046106ce565b6001602052600090815260409020546001600160a01b031681565b6100fe6101803660046106e7565b61025e565b6000828152600160205260409020546001600160a01b031633146101e3576000828152600160205260409081902054905163073e64fd60e21b81523360048201526001600160a01b0390911660248201526044015b60405180910390fd5b6101ed82826102d7565b5050565b6101f96102fc565b6002541561021a5760405163477a98ad60e01b815260040160405180910390fd5b6003541561023b576040516301646fff60e61b815260040160405180910390fd5b61024481610356565b60035550565b6102526102fc565b61025c600061044a565b565b6102666102fc565b6001600160a01b0381166102cb5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016101da565b6102d48161044a565b50565b806000815181106102ea576102ea610709565b60200260200101516002819055505050565b6000546001600160a01b0316331461025c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016101da565b602081015181516040808401516080850151606086015160a087015193516305d3b1d360e41b8152600481019590955267ffffffffffffffff909216602485015261ffff16604484015263ffffffff908116606484015216608482015260009182916001600160a01b0390911690635d3b1d309060a4016020604051808303816000875af11580156103ec573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610410919061071f565b60209384015160008281526001909552604090942080546001600160a01b0319166001600160a01b03909516949094179093555090919050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060208083528351808285015260005b818110156104c7578581018301518582016040015282016104ab565b818111156104d9576000604083870101525b50601f01601f1916929092016040019392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561052e5761052e6104ef565b604052919050565b6000806040838503121561054957600080fd5b8235915060208084013567ffffffffffffffff8082111561056957600080fd5b818601915086601f83011261057d57600080fd5b81358181111561058f5761058f6104ef565b8060051b91506105a0848301610505565b81815291830184019184810190898411156105ba57600080fd5b938501935b838510156105d8578435825293850193908501906105bf565b8096505050505050509250929050565b80356001600160a01b03811681146105ff57600080fd5b919050565b803563ffffffff811681146105ff57600080fd5b803561ffff811681146105ff57600080fd5b600060c0828403121561063c57600080fd5b60405160c0810167ffffffffffffffff8282108183111715610660576106606104ef565b8160405284358352610674602086016105e8565b602084015260408501359150808216821461068e57600080fd5b5060408201526106a060608401610604565b60608201526106b160808401610618565b60808201526106c260a08401610604565b60a08201529392505050565b6000602082840312156106e057600080fd5b5035919050565b6000602082840312156106f957600080fd5b610702826105e8565b9392505050565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561073157600080fd5b505191905056fea264697066735822122041f1e139b401426357987d91025f5fe5470015b4d5f5bed4100077dade0b997164736f6c634300080c0033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100925760003560e01c8063715018a611610066578063715018a6146101135780637d94792a1461011b5780638da5cb5b14610124578063ab0e8a0f14610149578063f2fde38b1461017257600080fd5b80626d6cae1461009757806306fdde03146100b35780631fe543e3146100eb578063231fff1414610100575b600080fd5b6100a060035481565b6040519081526020015b60405180910390f35b6100de6040518060400160405280600c81526020016b386c69656e73204d6167696360a01b81525081565b6040516100aa919061049a565b6100fe6100f9366004610536565b610185565b005b6100fe61010e36600461062a565b6101f1565b6100fe61024a565b6100a060025481565b6000546001600160a01b03165b6040516001600160a01b0390911681526020016100aa565b6101316101573660046106ce565b6001602052600090815260409020546001600160a01b031681565b6100fe6101803660046106e7565b61025e565b6000828152600160205260409020546001600160a01b031633146101e3576000828152600160205260409081902054905163073e64fd60e21b81523360048201526001600160a01b0390911660248201526044015b60405180910390fd5b6101ed82826102d7565b5050565b6101f96102fc565b6002541561021a5760405163477a98ad60e01b815260040160405180910390fd5b6003541561023b576040516301646fff60e61b815260040160405180910390fd5b61024481610356565b60035550565b6102526102fc565b61025c600061044a565b565b6102666102fc565b6001600160a01b0381166102cb5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016101da565b6102d48161044a565b50565b806000815181106102ea576102ea610709565b60200260200101516002819055505050565b6000546001600160a01b0316331461025c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016101da565b602081015181516040808401516080850151606086015160a087015193516305d3b1d360e41b8152600481019590955267ffffffffffffffff909216602485015261ffff16604484015263ffffffff908116606484015216608482015260009182916001600160a01b0390911690635d3b1d309060a4016020604051808303816000875af11580156103ec573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610410919061071f565b60209384015160008281526001909552604090942080546001600160a01b0319166001600160a01b03909516949094179093555090919050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060208083528351808285015260005b818110156104c7578581018301518582016040015282016104ab565b818111156104d9576000604083870101525b50601f01601f1916929092016040019392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561052e5761052e6104ef565b604052919050565b6000806040838503121561054957600080fd5b8235915060208084013567ffffffffffffffff8082111561056957600080fd5b818601915086601f83011261057d57600080fd5b81358181111561058f5761058f6104ef565b8060051b91506105a0848301610505565b81815291830184019184810190898411156105ba57600080fd5b938501935b838510156105d8578435825293850193908501906105bf565b8096505050505050509250929050565b80356001600160a01b03811681146105ff57600080fd5b919050565b803563ffffffff811681146105ff57600080fd5b803561ffff811681146105ff57600080fd5b600060c0828403121561063c57600080fd5b60405160c0810167ffffffffffffffff8282108183111715610660576106606104ef565b8160405284358352610674602086016105e8565b602084015260408501359150808216821461068e57600080fd5b5060408201526106a060608401610604565b60608201526106b160808401610618565b60808201526106c260a08401610604565b60a08201529392505050565b6000602082840312156106e057600080fd5b5035919050565b6000602082840312156106f957600080fd5b610702826105e8565b9392505050565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561073157600080fd5b505191905056fea264697066735822122041f1e139b401426357987d91025f5fe5470015b4d5f5bed4100077dade0b997164736f6c634300080c0033

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

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