Contract 0xa68419d04f71a06c10e18a6c911aa570dabf5186

Contract Overview

Balance:
0 MATIC

Token:
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x6270bfe559cf5a7ba0973189837799622c7315c11cccfe8bc25a98ae9af8e780Set Buddy Synthe...218709712021-11-24 16:05:367 days 6 hrs ago0x3e848fa9556813c1c521f194515e01ba0cb5eeae IN  0xa68419d04f71a06c10e18a6c911aa570dabf51860 MATIC0.000161112
0xc0dad96b2dc19d24f87573e45cfb5f2b7e0d323cd7a32f1e4f044b7fe90c308bSet Buddy Logic ...218709712021-11-24 16:05:367 days 6 hrs ago0x3e848fa9556813c1c521f194515e01ba0cb5eeae IN  0xa68419d04f71a06c10e18a6c911aa570dabf51860 MATIC0.000161259
0xc61453811e0d1e88fef07fbfe3d0c30408bdd8c21c1a3cfda24b64ae4b401c79Set Buddy Core A...218709702021-11-24 16:05:347 days 6 hrs ago0x3e848fa9556813c1c521f194515e01ba0cb5eeae IN  0xa68419d04f71a06c10e18a6c911aa570dabf51860 MATIC0.0001615915
0x5bb143d5c9415b3d88d8cdde3c0a7ae25cac9f14c527bf881c18920fc0e793820x60c06040218709632021-11-24 16:05:207 days 6 hrs ago0x3e848fa9556813c1c521f194515e01ba0cb5eeae IN  Contract Creation0 MATIC0.003259256
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
BuddyRandomness

Compiler Version
v0.8.10+commit.fc410830

Optimization Enabled:
Yes with 333 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 8 : BuddyRandomness.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;

// |  \/  (_)              |  _ \          | |   | (_)
// | \  / |_  ___ _ __ ___ | |_) |_   _  __| | __| |_  ___  ___ ™
// | |\/| | |/ __| '__/ _ \|  _ <| | | |/ _` |/ _` | |/ _ \/ __|
// | |  | | | (__| | | (_) | |_) | |_| | (_| | (_| | |  __/\__ \
// |_|  |_|_|\___|_|  \___/|____/ \__,_|\__,_|\__,_|_|\___||___/ 2021

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./interfaces/IBuddyRandomness.sol";
import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol";

contract BuddyRandomness is IBuddyRandomness, VRFConsumerBase, Ownable {
    address public _buddyCore;
    address public _buddyLogic;
    address public _buddySynthesizer;

    bytes32 internal keyHash;
    uint256 internal fee;

    mapping(uint256 => uint256[]) internal _randoms;
    mapping(bytes32 => uint256) internal requests;

    constructor()
        VRFConsumerBase(
            0x8C7382F9D8f56b33781fE506E897a4F1e2d17255, // VRF Coordinator
            0x326C977E6efc84E512bB9C30f76E30c160eD06FB // LINK Token
        )
    {
        keyHash = 0x6e75b569a01ef56d18cab6a8e71e6600d6ce853834d4a5748b720d06f878b3a4;
        fee = 0.0001 * 10**18;
    }

    function setBuddyCoreAddr(address buddyCoreAddr) public onlyOwner {
        require(address(_buddyCore) == address(0), "Buddy addr already set");
        _buddyCore = buddyCoreAddr;
    }

    function setBuddyLogicAddr(address buddyLogicAddr)
        public
        override
        onlyOwner
    {
        _buddyLogic = buddyLogicAddr;
    }

    function setBuddySynthesizerAddr(address buddySynthesizerAddr)
        public
        override
        onlyOwner
    {
        _buddySynthesizer = buddySynthesizerAddr;
    }

    modifier onlyBuddyCore() {
        require(msg.sender == _buddyCore, "Unauthorized");
        _;
    }

    modifier onlyApproved() {
        require(
            msg.sender == _buddyLogic || msg.sender == _buddySynthesizer,
            "Unauthorized"
        );
        _;
    }

    function withdrawLink() external onlyOwner {
        uint256 balance = LINK.balanceOf(address(this));
        require(balance > 0, "No Link available!");
        LINK.transfer(owner(), balance);
    }

    uint256 nonce;

    function generateRandom(uint256 tokenId) external override onlyBuddyCore {
        requests[getRandomNumber()] = tokenId;
    }

    function getRandomResult(uint256 tokenId)
        external
        view
        override
        onlyBuddyCore
        returns (uint256)
    {
        return _randoms[tokenId].length;
    }

    function rng(uint256 tokenId, uint256 max)
        external
        override
        onlyApproved
        returns (uint256 rand)
    {
        return rollNewGuess(tokenId, max);
    }

    function rollNewGuess(uint256 tokenId, uint256 max)
        private
        returns (uint256 rand)
    {
        if (max == 0) {
            return 0;
        }

        uint256[] storage nonces = _randoms[tokenId];
        uint256 randomResult = nonces[nonces.length - 1];
        rand =
            (uint256(keccak256(abi.encode(randomResult, nonces.length))) %
                max) +
            1;

        _randoms[tokenId].push(randomResult);
    }

    /**
     * Requests randomness
     */
    function getRandomNumber() private returns (bytes32 requestId) {
        require(
            LINK.balanceOf(address(this)) >= fee,
            "Not enough LINK to generate randomness"
        );
        return requestRandomness(keyHash, fee);
    }

    /**
     * Callback function used by VRF Coordinator
     */
    function fulfillRandomness(bytes32 requestId, uint256 randomness)
        internal
        override
    {
        uint256 tokenId = requests[requestId];
        uint256 length = _randoms[tokenId].length;

        if (length == 0) {
            _randoms[tokenId] = [randomness];
        } else {
            _randoms[tokenId].push(randomness);
        }
    }
}

File 2 of 8 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

File 3 of 8 : Ownable.sol
// SPDX-License-Identifier: MIT

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() {
        _setOwner(_msgSender());
    }

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _setOwner(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");
        _setOwner(newOwner);
    }

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 4 of 8 : IBuddyRandomness.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;

interface IBuddyRandomness {
    function setBuddySynthesizerAddr(address) external;

    function setBuddyLogicAddr(address) external;

    function generateRandom(uint256) external;

    function getRandomResult(uint256) external view returns (uint256);

    function rng(uint256, uint256) external returns (uint256);
}

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

import "./interfaces/LinkTokenInterface.sol";

import "./VRFRequestIDBase.sol";

/** ****************************************************************************
 * @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.
 * *****************************************************************************
 * @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     constuctor(<other arguments>, address _vrfCoordinator, address _link)
 * @dev       VRFConsumerBase(_vrfCoordinator, _link) 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), and have told you the minimum LINK
 * @dev price for VRF service. Make sure your contract has sufficient LINK, and
 * @dev call requestRandomness(keyHash, fee, seed), where seed is the input you
 * @dev want to generate randomness from.
 *
 * @dev Once the VRFCoordinator has received and validated the oracle's response
 * @dev to your request, it will call your contract's fulfillRandomness method.
 *
 * @dev The randomness argument to fulfillRandomness is the actual random value
 * @dev generated from your seed.
 *
 * @dev The requestId argument is generated from the keyHash and the seed by
 * @dev makeRequestId(keyHash, seed). If your contract could have concurrent
 * @dev requests open, you can use the requestId to track which seed is
 * @dev associated with which randomness. See VRFRequestIDBase.sol for more
 * @dev details. (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. (Which is critical to making unpredictable randomness! See the
 * @dev next section.)
 *
 * *****************************************************************************
 * @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 ultimate input to the VRF is mixed with the block hash of the
 * @dev block in which the request is made, user-provided seeds have no impact
 * @dev on its economic security properties. They are only included for API
 * @dev compatability with previous versions of this contract.
 *
 * @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.
 */
abstract contract VRFConsumerBase is VRFRequestIDBase {

  /**
   * @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 VRFConsumerBase 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 randomness the VRF output
   */
  function fulfillRandomness(
    bytes32 requestId,
    uint256 randomness
  )
    internal
    virtual;

  /**
   * @dev In order to keep backwards compatibility we have kept the user
   * seed field around. We remove the use of it because given that the blockhash
   * enters later, it overrides whatever randomness the used seed provides.
   * Given that it adds no security, and can easily lead to misunderstandings,
   * we have removed it from usage and can now provide a simpler API.
   */
  uint256 constant private USER_SEED_PLACEHOLDER = 0;

  /**
   * @notice requestRandomness initiates a request for VRF output given _seed
   *
   * @dev The fulfillRandomness method receives the output, once it's provided
   * @dev by the Oracle, and verified by the vrfCoordinator.
   *
   * @dev The _keyHash must already be registered with the VRFCoordinator, and
   * @dev the _fee must exceed the fee specified during registration of the
   * @dev _keyHash.
   *
   * @dev The _seed parameter is vestigial, and is kept only for API
   * @dev compatibility with older versions. It can't *hurt* to mix in some of
   * @dev your own randomness, here, but it's not necessary because the VRF
   * @dev oracle will mix the hash of the block containing your request into the
   * @dev VRF seed it ultimately uses.
   *
   * @param _keyHash ID of public key against which randomness is generated
   * @param _fee The amount of LINK to send with the request
   *
   * @return requestId unique ID for this request
   *
   * @dev The returned requestId can be used to distinguish responses to
   * @dev concurrent requests. It is passed as the first argument to
   * @dev fulfillRandomness.
   */
  function requestRandomness(
    bytes32 _keyHash,
    uint256 _fee
  )
    internal
    returns (
      bytes32 requestId
    )
  {
    LINK.transferAndCall(vrfCoordinator, _fee, abi.encode(_keyHash, USER_SEED_PLACEHOLDER));
    // This is the seed passed to VRFCoordinator. The oracle will mix this with
    // the hash of the block containing this request to obtain the seed/input
    // which is finally passed to the VRF cryptographic machinery.
    uint256 vRFSeed  = makeVRFInputSeed(_keyHash, USER_SEED_PLACEHOLDER, address(this), nonces[_keyHash]);
    // nonces[_keyHash] must stay in sync with
    // VRFCoordinator.nonces[_keyHash][this], which was incremented by the above
    // successful LINK.transferAndCall (in VRFCoordinator.randomnessRequest).
    // This provides protection against the user repeating their input seed,
    // which would result in a predictable/duplicate output, if multiple such
    // requests appeared in the same block.
    nonces[_keyHash] = nonces[_keyHash] + 1;
    return makeRequestId(_keyHash, vRFSeed);
  }

  LinkTokenInterface immutable internal LINK;
  address immutable private vrfCoordinator;

  // Nonces for each VRF key from which randomness has been requested.
  //
  // Must stay in sync with VRFCoordinator[_keyHash][this]
  mapping(bytes32 /* keyHash */ => uint256 /* nonce */) private nonces;

  /**
   * @param _vrfCoordinator address of VRFCoordinator contract
   * @param _link address of LINK token contract
   *
   * @dev https://docs.chain.link/docs/link-token-contracts
   */
  constructor(
    address _vrfCoordinator,
    address _link
  ) {
    vrfCoordinator = _vrfCoordinator;
    LINK = LinkTokenInterface(_link);
  }

  // rawFulfillRandomness is called by VRFCoordinator when it receives a valid VRF
  // proof. rawFulfillRandomness then calls fulfillRandomness, after validating
  // the origin of the call
  function rawFulfillRandomness(
    bytes32 requestId,
    uint256 randomness
  )
    external
  {
    require(msg.sender == vrfCoordinator, "Only VRFCoordinator can fulfill");
    fulfillRandomness(requestId, randomness);
  }
}

File 6 of 8 : Context.sol
// SPDX-License-Identifier: MIT

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 7 of 8 : 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 8 of 8 : VRFRequestIDBase.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract VRFRequestIDBase {

  /**
   * @notice returns the seed which is actually input to the VRF coordinator
   *
   * @dev To prevent repetition of VRF output due to repetition of the
   * @dev user-supplied seed, that seed is combined in a hash with the
   * @dev user-specific nonce, and the address of the consuming contract. The
   * @dev risk of repetition is mostly mitigated by inclusion of a blockhash in
   * @dev the final seed, but the nonce does protect against repetition in
   * @dev requests which are included in a single block.
   *
   * @param _userSeed VRF seed input provided by user
   * @param _requester Address of the requesting contract
   * @param _nonce User-specific nonce at the time of the request
   */
  function makeVRFInputSeed(
    bytes32 _keyHash,
    uint256 _userSeed,
    address _requester,
    uint256 _nonce
  )
    internal
    pure
    returns (
      uint256
    )
  {
    return uint256(keccak256(abi.encode(_keyHash, _userSeed, _requester, _nonce)));
  }

  /**
   * @notice Returns the id for this request
   * @param _keyHash The serviceAgreement ID to be used for this request
   * @param _vRFInputSeed The seed to be passed directly to the VRF
   * @return The id for this request
   *
   * @dev Note that _vRFInputSeed is not the seed passed by the consuming
   * @dev contract, but the one generated by makeVRFInputSeed
   */
  function makeRequestId(
    bytes32 _keyHash,
    uint256 _vRFInputSeed
  )
    internal
    pure
    returns (
      bytes32
    )
  {
    return keccak256(abi.encodePacked(_keyHash, _vRFInputSeed));
  }
}

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

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"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":"_buddyCore","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_buddyLogic","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_buddySynthesizer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"generateRandom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getRandomResult","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"requestId","type":"bytes32"},{"internalType":"uint256","name":"randomness","type":"uint256"}],"name":"rawFulfillRandomness","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"}],"name":"rng","outputs":[{"internalType":"uint256","name":"rand","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"buddyCoreAddr","type":"address"}],"name":"setBuddyCoreAddr","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"buddyLogicAddr","type":"address"}],"name":"setBuddyLogicAddr","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"buddySynthesizerAddr","type":"address"}],"name":"setBuddySynthesizerAddr","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawLink","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60c060405234801561001057600080fd5b50738c7382f9d8f56b33781fe506e897a4f1e2d1725560a05273326c977e6efc84e512bb9c30f76e30c160ed06fb60805261004a3361007d565b7f6e75b569a01ef56d18cab6a8e71e6600d6ce853834d4a5748b720d06f878b3a4600555655af3107a40006006556100cf565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60805160a051610ea1610110600039600081816106650152610b140152600081816104d20152818161058e0152818161093c0152610ae50152610ea16000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c80638dc654a21161008c578063b0e42b6711610066578063b0e42b67146101c2578063ed30a6d4146101d5578063f13fad54146101e8578063f2fde38b146101fb57600080fd5b80638dc654a21461019457806394985ddd1461019c578063aea2035f146101af57600080fd5b806366947688116100c8578063669476881461013d578063715018a614610150578063776e8eee146101585780638da5cb5b1461018357600080fd5b80630ae6a811146100ef5780630cff933614610104578063530104081461012a575b600080fd5b6101026100fd366004610cbb565b61020e565b005b610117610112366004610ceb565b61027d565b6040519081526020015b60405180910390f35b610102610138366004610d0d565b6102f1565b61010261014b366004610cbb565b61035b565b61010261041e565b60035461016b906001600160a01b031681565b6040516001600160a01b039091168152602001610121565b6001546001600160a01b031661016b565b610102610472565b6101026101aa366004610ceb565b61065a565b6101176101bd366004610d0d565b6106dc565b60045461016b906001600160a01b031681565b60025461016b906001600160a01b031681565b6101026101f6366004610cbb565b61073b565b610102610209366004610cbb565b6107a5565b6001546001600160a01b0316331461025b5760405162461bcd60e51b81526020600482018190526024820152600080516020610e4c83398151915260448201526064015b60405180910390fd5b600480546001600160a01b0319166001600160a01b0392909216919091179055565b6003546000906001600160a01b03163314806102a357506004546001600160a01b031633145b6102de5760405162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b6044820152606401610252565b6102e8838361085e565b90505b92915050565b6002546001600160a01b0316331461033a5760405162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b6044820152606401610252565b8060086000610347610918565b815260208101919091526040016000205550565b6001546001600160a01b031633146103a35760405162461bcd60e51b81526020600482018190526024820152600080516020610e4c8339815191526044820152606401610252565b6002546001600160a01b0316156103fc5760405162461bcd60e51b815260206004820152601660248201527f4275646479206164647220616c726561647920736574000000000000000000006044820152606401610252565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6001546001600160a01b031633146104665760405162461bcd60e51b81526020600482018190526024820152600080516020610e4c8339815191526044820152606401610252565b6104706000610a17565b565b6001546001600160a01b031633146104ba5760405162461bcd60e51b81526020600482018190526024820152600080516020610e4c8339815191526044820152606401610252565b6040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015610521573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105459190610d26565b90506000811161058c5760405162461bcd60e51b81526020600482015260126024820152714e6f204c696e6b20617661696c61626c652160701b6044820152606401610252565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663a9059cbb6105cd6001546001600160a01b031690565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526001600160a01b039091166004820152602481018490526044016020604051808303816000875af1158015610632573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106569190610d3f565b5050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146106d25760405162461bcd60e51b815260206004820152601f60248201527f4f6e6c7920565246436f6f7264696e61746f722063616e2066756c66696c6c006044820152606401610252565b6106568282610a69565b6002546000906001600160a01b031633146107285760405162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b6044820152606401610252565b5060009081526007602052604090205490565b6001546001600160a01b031633146107835760405162461bcd60e51b81526020600482018190526024820152600080516020610e4c8339815191526044820152606401610252565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6001546001600160a01b031633146107ed5760405162461bcd60e51b81526020600482018190526024820152600080516020610e4c8339815191526044820152606401610252565b6001600160a01b0381166108525760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610252565b61085b81610a17565b50565b60008161086d575060006102eb565b60008381526007602052604081208054909190829061088e90600190610d77565b8154811061089e5761089e610d8e565b60009182526020918290200154835460408051938401839052830152915084906060016040516020818303038152906040528051906020012060001c6108e49190610da4565b6108ef906001610dc6565b600095865260076020908152604087208054600181018255908852962090950155509192915050565b6006546040516370a0823160e01b8152306004820152600091906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015610983573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a79190610d26565b1015610a045760405162461bcd60e51b815260206004820152602660248201527f4e6f7420656e6f756768204c494e4b20746f2067656e65726174652072616e646044820152656f6d6e65737360d01b6064820152608401610252565b610a12600554600654610ae1565b905090565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60008281526008602090815260408083205480845260079092529091205480610ab95760408051602080820183528582526000858152600790915291909120610ab3916001610c5b565b50610adb565b6000828152600760209081526040822080546001810182559083529120018390555b50505050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316634000aea07f000000000000000000000000000000000000000000000000000000000000000084866000604051602001610b51929190918252602082015260400190565b6040516020818303038152906040526040518463ffffffff1660e01b8152600401610b7e93929190610dde565b6020604051808303816000875af1158015610b9d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc19190610d3f565b5060008381526020818152604080832054815180840188905280830185905230606082015260808082018390528351808303909101815260a090910190925281519183019190912086845292909152610c1b906001610dc6565b6000858152602081815260409182902092909255805180830187905280820184905281518082038301815260609091019091528051910120949350505050565b828054828255906000526020600020908101928215610c96579160200282015b82811115610c96578251825591602001919060010190610c7b565b50610ca2929150610ca6565b5090565b5b80821115610ca25760008155600101610ca7565b600060208284031215610ccd57600080fd5b81356001600160a01b0381168114610ce457600080fd5b9392505050565b60008060408385031215610cfe57600080fd5b50508035926020909101359150565b600060208284031215610d1f57600080fd5b5035919050565b600060208284031215610d3857600080fd5b5051919050565b600060208284031215610d5157600080fd5b81518015158114610ce457600080fd5b634e487b7160e01b600052601160045260246000fd5b600082821015610d8957610d89610d61565b500390565b634e487b7160e01b600052603260045260246000fd5b600082610dc157634e487b7160e01b600052601260045260246000fd5b500690565b60008219821115610dd957610dd9610d61565b500190565b6001600160a01b038416815260006020848184015260606040840152835180606085015260005b81811015610e2157858101830151858201608001528201610e05565b81811115610e33576000608083870101525b50601f01601f1916929092016080019594505050505056fe4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a264697066735822122016c7c6681de8270c0e6f2596faa89684629315d7667ff2806a19c5932a7a276364736f6c634300080a0033

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading