Contract 0xC6bDE2d979F44B05cDBF90B0Eb335C37Ed9A4081

Contract Overview

Balance:
0 MATIC
Txn Hash
Method
Block
From
To
Value [Txn Fee]
0x8ac9cc2f06900e7f42a5ca770e241749487d5076d57ed1eacfe74bd0117873b5Pause291994032022-11-17 13:41:14130 days 22 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  0xc6bde2d979f44b05cdbf90b0eb335c37ed9a40810 MATIC0.0000362374991.299999996
0x904c3275fbe9c55ced81050e341b2aeabc4fde05af1cca3416f006f7b1cdf0c8Withdraw Tokens ...291993972022-11-17 13:40:14130 days 22 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  0xc6bde2d979f44b05cdbf90b0eb335c37ed9a40810 MATIC0.0000554306991.299999998
0x6624801606186349603751f0b0627e2421d3f008515c323e3acff8c13736e3a8Wager290750562022-11-10 6:52:05138 days 5 hrs ago0x6d76f1d18d1da5711817b966f798c5ae7254b21f IN  0xc6bde2d979f44b05cdbf90b0eb335c37ed9a40810.259820173436283 MATIC0.000482841003 1.500000011
0xec63605e482cce1d5d0f40f2e80cd2e621b522874550741e03f75d555bbbf433Wager288632092022-10-28 23:38:56150 days 12 hrs ago0xde6d7b739699c109f25cd017b0f6faeef7da335e IN  0xc6bde2d979f44b05cdbf90b0eb335c37ed9a40810.031453873032209 MATIC0.013110017127 42.563608737
0x845f248abb2611d71c8f791f91a57b2aa14b597d492743e2cab816a49fe497d0Wager288631982022-10-28 23:38:01150 days 12 hrs ago0xde6d7b739699c109f25cd017b0f6faeef7da335e IN  0xc6bde2d979f44b05cdbf90b0eb335c37ed9a40810.031453873032209 MATIC0.013110017127 42.563608737
0x26cb8ef49cc9493bb24448a3a069d4a923a1f73ef6c2336c0d70684bfd86019bWager288631892022-10-28 23:37:16150 days 12 hrs ago0xde6d7b739699c109f25cd017b0f6faeef7da335e IN  0xc6bde2d979f44b05cdbf90b0eb335c37ed9a40810.031453873035944 MATIC0.013837854839 42.563608746
0x116b5e50c9b88c38063e4fa98f436ed7ef391c5d25e1f630f943b8db86b043f5Wager286852592022-10-18 15:38:06160 days 20 hrs ago0xf4ee4149559ef4b8c6cef656857e6307566b556d IN  0xc6bde2d979f44b05cdbf90b0eb335c37ed9a40810.028329145737975 MATIC0.010500151906 34.090295465
0x22807d1bff0a8ea1efcc1cf5f978bee1ac3c96db6663d55c8634134810ec92aeWager286852312022-10-18 15:35:45160 days 20 hrs ago0xf4ee4149559ef4b8c6cef656857e6307566b556d IN  0xc6bde2d979f44b05cdbf90b0eb335c37ed9a40810.03317249329754 MATIC0.014877362766 45.761012476
0x0a30066ebc5abda5e8837b87e1ca5cd01b73c7ca93c1491f61a43694b1c7ee13Wager285644882022-10-11 15:18:20167 days 20 hrs ago0x2014123af11831272e5f6fac4674ac33eb32a7b4 IN  0xc6bde2d979f44b05cdbf90b0eb335c37ed9a40810.044676981422645 MATIC0.01617625204 49.754406163
0xdafc7afb4d152643705d31da89634c94524304f253954f18796e86357ae4b6ddWager281280562022-09-16 5:33:05193 days 6 hrs ago0x365b285ed793425af11dc581bafab513638fb00a IN  0xc6bde2d979f44b05cdbf90b0eb335c37ed9a40811.059196086835943 MATIC0.004344900001 50.000000017
0x5060f1c5671638ce629174d4009dca9f27ed0c9c9df954e0648cefdcd3ccd7bfWager281280372022-09-16 5:31:30193 days 6 hrs ago0x365b285ed793425af11dc581bafab513638fb00a IN  0xc6bde2d979f44b05cdbf90b0eb335c37ed9a40810.981196086835113 MATIC0.004344900001 50.000000015
0x3868d466fdd7706483e964320df3fc7bc01c8d2f01357414f1d5f604813de5f1Wager280820672022-09-13 13:28:31195 days 22 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  0xc6bde2d979f44b05cdbf90b0eb335c37ed9a40810.014832872750395 MATIC0.000829859254 2.425000013
0x71380fd0bb9f1cca431dce5db9d4ca68a9a8e130a2b4ecb36d0dbf99f1bf0b24Set VRF Callback...280089792022-09-09 7:35:54200 days 4 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  0xc6bde2d979f44b05cdbf90b0eb335c37ed9a40810 MATIC0.0000461791.500000026
0x1a2874fd304a4ae6f75e736b83161dcccd8013003f9fa5d950b89ccc90ce8c5dSet House Edge280089772022-09-09 7:35:44200 days 4 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  0xc6bde2d979f44b05cdbf90b0eb335c37ed9a40810 MATIC0.0000722385011.500000028
0xfdfe844fd178ae3705d66a1415babffa3d2df72752b16e398507904aad5bad58Set VRF Callback...280089512022-09-09 7:33:33200 days 4 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  0xc6bde2d979f44b05cdbf90b0eb335c37ed9a40810 MATIC0.0000461791.500000024
0xbc01530761ccd24a0c77d5eaffa5642cf7a1a85f2ae62a1f9006c8e9c1f5cb79Set House Edge280089502022-09-09 7:33:28200 days 4 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  0xc6bde2d979f44b05cdbf90b0eb335c37ed9a40810 MATIC0.0000722205011.500000023
0x7f0933eca37994ac52d740b575e72b3372d56c95786444cad7dcca39943e7c96Set VRF Callback...280089362022-09-09 7:32:18200 days 4 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  0xc6bde2d979f44b05cdbf90b0eb335c37ed9a40810 MATIC0.0000458191.500000018
0x441748ba521265227839889eb29888470d255fa1d829e5b40d6ea128b8d0cc26Set House Edge280089352022-09-09 7:32:13200 days 4 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  0xc6bde2d979f44b05cdbf90b0eb335c37ed9a40810 MATIC0.00007187851.500000018
0x479dda19c5ae0b31c5ceac6e28ddfdb0636edd10fbd14eee343c44c3fbd68700Set Chainlink Co...280088232022-09-09 7:22:51200 days 4 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  0xc6bde2d979f44b05cdbf90b0eb335c37ed9a40810 MATIC0.0000791445011.500000022
0x1eea0e7659e27f2709742f2b0adf7fc0453d13dbb3fcc1b4f24cab1637b56f2f0x60c06040280088122022-09-09 7:21:56200 days 4 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN  Create: Dice0 MATIC0.0044630220531.500000018
[ Download CSV Export 
Latest 11 internal transactions
Parent Txn Hash Block From To Value
0x904c3275fbe9c55ced81050e341b2aeabc4fde05af1cca3416f006f7b1cdf0c8291993972022-11-17 13:40:14130 days 22 hrs ago 0xc6bde2d979f44b05cdbf90b0eb335c37ed9a40810x2c305888a456e7004663bc12a74395e637eabcbc0.140084637441757348 MATIC
0x1d251fc721a43ac4cb21ec6b2aab10972da94c39e4459b841f0311578ff9ec99290750602022-11-10 6:52:25138 days 5 hrs ago 0xc6bde2d979f44b05cdbf90b0eb335c37ed9a4081 0x3f6bcd0761871ce301cac4c7984b0105adb737ce0.25560864830344604 MATIC
0xa23571557791c816297609702a0d494cf3f12703615f8719b134fcc87a9fffea288632152022-10-28 23:39:26150 days 12 hrs ago 0xc6bde2d979f44b05cdbf90b0eb335c37ed9a4081 0x3f6bcd0761871ce301cac4c7984b0105adb737ce0.01 MATIC
0x8d814f2d066e964600004136881c9e16bf13fbfd7efde371de9e59d34363d0da288632042022-10-28 23:38:31150 days 12 hrs ago 0xc6bde2d979f44b05cdbf90b0eb335c37ed9a4081 0x3f6bcd0761871ce301cac4c7984b0105adb737ce0.01 MATIC
0xd50e94116be4bbbee5b805f2d9235f8c9ce504fa961de05ae17225147047532a288631942022-10-28 23:37:41150 days 12 hrs ago 0xc6bde2d979f44b05cdbf90b0eb335c37ed9a4081 0x3f6bcd0761871ce301cac4c7984b0105adb737ce0.01 MATIC
0xe73a32487f91a7deab8f90cbd0196e38fc34c9163b0f60109aff922c0a8262ff286852642022-10-18 15:38:31160 days 20 hrs ago 0xc6bde2d979f44b05cdbf90b0eb335c37ed9a4081 0x3f6bcd0761871ce301cac4c7984b0105adb737ce0.0003 MATIC
0xe73a32487f91a7deab8f90cbd0196e38fc34c9163b0f60109aff922c0a8262ff286852642022-10-18 15:38:31160 days 20 hrs ago 0xc6bde2d979f44b05cdbf90b0eb335c37ed9a40810xf4ee4149559ef4b8c6cef656857e6307566b556d0.0097 MATIC
0x0eb09037b9d63a1b1a6263e2e76753970e2089f140ea5d4380f2b9efd4d51293286852372022-10-18 15:36:15160 days 20 hrs ago 0xc6bde2d979f44b05cdbf90b0eb335c37ed9a4081 0x3f6bcd0761871ce301cac4c7984b0105adb737ce0.01 MATIC
0x0385d2642d8bf3ceb624655df4d8a5af3ede84a1a78d595288c7cb370592e7c6285644932022-10-11 15:18:45167 days 20 hrs ago 0xc6bde2d979f44b05cdbf90b0eb335c37ed9a4081 0x3f6bcd0761871ce301cac4c7984b0105adb737ce0.0195 MATIC
0xfd0e6c4c5304806eeca4beea38a0aa9e17d7e900bc3fde7fd31f872640eb6765280820722022-09-13 13:28:56195 days 22 hrs ago 0xc6bde2d979f44b05cdbf90b0eb335c37ed9a4081 0x3f6bcd0761871ce301cac4c7984b0105adb737ce0.0003 MATIC
0xfd0e6c4c5304806eeca4beea38a0aa9e17d7e900bc3fde7fd31f872640eb6765280820722022-09-13 13:28:56195 days 22 hrs ago 0xc6bde2d979f44b05cdbf90b0eb335c37ed9a40810x2c305888a456e7004663bc12a74395e637eabcbc0.0097 MATIC
[ Download CSV Export 
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.

Contract Source Code Verified (Exact Match)

Contract Name:
Dice

Compiler Version
v0.8.16+commit.07a7930e

Optimization Enabled:
Yes with 8000 runs

Other Settings:
default evmVersion, MIT license
File 1 of 15 : VRFConsumerBaseV2.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

/** ****************************************************************************
 * @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 2 of 15 : AggregatorV3Interface.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface AggregatorV3Interface {
  function decimals() external view returns (uint8);

  function description() external view returns (string memory);

  function version() external view returns (uint256);

  // getRoundData and latestRoundData should both raise "No data present"
  // if they do not have data to report, instead of returning unset values
  // which could be misinterpreted as actual reported values.
  function getRoundData(uint80 _roundId)
    external
    view
    returns (
      uint80 roundId,
      int256 answer,
      uint256 startedAt,
      uint256 updatedAt,
      uint80 answeredInRound
    );

  function latestRoundData()
    external
    view
    returns (
      uint80 roundId,
      int256 answer,
      uint256 startedAt,
      uint256 updatedAt,
      uint80 answeredInRound
    );
}

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

pragma solidity ^0.8.0;

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

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

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

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

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

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

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

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

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

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

File 6 of 15 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

File 7 of 15 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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);

    /**
     * @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 `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, 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 `from` to `to` 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 from,
        address to,
        uint256 amount
    ) external returns (bool);
}

File 8 of 15 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 9 of 15 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 10 of 15 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly
                /// @solidity memory-safe-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 11 of 15 : 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 12 of 15 : Multicall.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Multicall.sol)

pragma solidity ^0.8.0;

import "./Address.sol";

/**
 * @dev Provides a function to batch together multiple calls in a single external call.
 *
 * _Available since v4.1._
 */
abstract contract Multicall {
    /**
     * @dev Receives and executes a batch of function calls on this contract.
     */
    function multicall(bytes[] calldata data) external virtual returns (bytes[] memory results) {
        results = new bytes[](data.length);
        for (uint256 i = 0; i < data.length; i++) {
            results[i] = Address.functionDelegateCall(address(this), data[i]);
        }
        return results;
    }
}

File 13 of 15 : IBank.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.16;

/// @notice Minimal interface for Bank.
/// @author Romuald Hog.
interface IBank {
    /// @notice Gets the token's allow status used on the games smart contracts.
    /// @param token Address of the token.
    /// @return Whether the token is enabled for bets.
    function isAllowedToken(address token) external view returns (bool);

    /// @notice Payouts a winning bet, and allocate the house edge fee.
    /// @param user Address of the gamer.
    /// @param token Address of the token.
    /// @param profit Number of tokens to be sent to the gamer.
    /// @param fees Bet amount and bet profit fees amount.
    function payout(
        address payable user,
        address token,
        uint256 profit,
        uint256 fees
    ) external payable;

    /// @notice Accounts a loss bet.
    /// @dev In case of an ERC20, the bet amount should be transfered prior to this tx.
    /// @dev In case of the gas token, the bet amount is sent along with this tx.
    /// @param tokenAddress Address of the token.
    /// @param amount Loss bet amount.
    function cashIn(address tokenAddress, uint256 amount) external payable;

    /// @notice Calculates the max bet amount based on the token balance, the balance risk, and the game multiplier.
    /// @param token Address of the token.
    /// @param multiplier The bet amount leverage determines the user's profit amount. 10000 = 100% = no profit.
    /// @return Maximum bet amount for the token.
    /// @dev The multiplier should be at least 10000.
    function getMaxBetAmount(address token, uint256 multiplier)
        external
        view
        returns (uint256);

    /// @notice Harvests tokens dividends.
    /// @return tokens The list of tokens addresses.
    /// @return amounts The list of tokens' amounts harvested.
    function harvestDividends()
        external
        returns (address[] memory tokens, uint256[] memory amounts);

    /// @notice Get the available tokens dividends amounts.
    /// @return tokens The list of tokens addresses.
    /// @return amounts The list of tokens' amounts harvested.
    function getDividends()
        external
        view
        returns (address[] memory tokens, uint256[] memory amounts);

    function getVRFSubId(address token) external view returns (uint64);

    function getTokenOwner(address token) external view returns (address);

    function getMinBetAmount(address token) external view returns (uint256);
}

File 14 of 15 : Dice.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.16;

import {Game} from "./Game.sol";

/// @title BetSwirl's Dice game
/// @notice The game is played with a 100 sided dice. The game's goal is to guess whether the lucky number will be above your chosen number.
/// @author Romuald Hog (based on Yakitori's Dice)
contract Dice is Game {
    /// @notice Full dice bet information struct.
    /// @param bet The Bet struct information.
    /// @param diceBet The Dice bet struct information.
    /// @dev Used to package bet information for the front-end.
    struct FullDiceBet {
        Bet bet;
        DiceBet diceBet;
    }

    /// @notice Dice bet information struct.
    /// @param cap The chosen dice number.
    /// @param rolled The rolled dice number.
    struct DiceBet {
        uint8 cap;
        uint8 rolled;
    }

    /// @notice Maps bets IDs to chosen and rolled dice numbers.
    mapping(uint256 => DiceBet) public diceBets;

    /// @notice Emitted after a bet is placed.
    /// @param id The bet ID.
    /// @param user Address of the gamer.
    /// @param token Address of the token.
    /// @param amount The bet amount.
    /// @param vrfCost The Chainlink VRF cost paid by player.
    /// @param cap The chosen dice number.
    event PlaceBet(
        uint256 id,
        address indexed user,
        address indexed token,
        uint256 amount,
        uint256 vrfCost,
        uint8 cap
    );

    /// @notice Emitted after a bet is rolled.
    /// @param id The bet ID.
    /// @param user Address of the gamer.
    /// @param token Address of the token.
    /// @param amount The bet amount.
    /// @param cap The chosen dice number.
    /// @param rolled The rolled dice number.
    /// @param payout The payout amount.
    event Roll(
        uint256 id,
        address indexed user,
        address indexed token,
        uint256 amount,
        uint8 cap,
        uint8 rolled,
        uint256 payout
    );

    /// @notice Provided cap is not within 1 and 99 included.
    /// @param minCap The minimum cap.
    /// @param maxCap The maximum cap.
    error CapNotInRange(uint8 minCap, uint8 maxCap);

    /// @notice Initialize the game base contract.
    /// @param bankAddress The address of the bank.
    /// @param chainlinkCoordinatorAddress Address of the Chainlink VRF Coordinator.
    /// @param LINK_ETH_feedAddress Address of the Chainlink LINK/ETH price feed.
    constructor(
        address bankAddress,
        address chainlinkCoordinatorAddress,
        address LINK_ETH_feedAddress
    ) Game(bankAddress, chainlinkCoordinatorAddress, 1, LINK_ETH_feedAddress) {}

    /// @notice Calculates the target payout amount.
    /// @param betAmount Bet amount.
    /// @param cap The chosen dice number.
    /// @return The target payout amount.
    function _getPayout(uint256 betAmount, uint8 cap)
        private
        pure
        returns (uint256)
    {
        return (betAmount * 100) / (100 - cap);
    }

    /// @notice Creates a new bet and stores the chosen dice number.
    /// @param cap The chosen dice number.
    /// @param token Address of the token.
    /// @param tokenAmount The number of tokens bet.
    function wager(
        uint8 cap,
        address token,
        uint256 tokenAmount
    ) external payable whenNotPaused {
        /// Dice cap 1 gives 99% chance.
        /// Dice cap 99 gives 1% chance.
        if (cap == 0 || cap > 99) {
            revert CapNotInRange(1, 99);
        }

        Bet memory bet = _newBet(
            token,
            tokenAmount,
            _getPayout(10000, cap)
        );
        diceBets[bet.id].cap = cap;

        emit PlaceBet(bet.id, bet.user, bet.token, bet.amount, bet.vrfCost, cap);
    }

    /// @notice Resolves the bet using the Chainlink randomness.
    /// @param id The bet ID.
    /// @param randomWords Random words list. Contains only one for this game.
    // solhint-disable-next-line private-vars-leading-underscore
    function fulfillRandomWords(uint256 id, uint256[] memory randomWords)
        internal
        override
    {
        DiceBet storage diceBet = diceBets[id];
        Bet storage bet = bets[id];

        uint8 rolled = uint8((randomWords[0] % 100) + 1);
        diceBet.rolled = rolled;
        uint256 payout = _resolveBet(
            bet,
            rolled > diceBet.cap,
            _getPayout(bet.amount, diceBet.cap)
        );

        emit Roll(
            bet.id,
            bet.user,
            bet.token,
            bet.amount,
            diceBet.cap,
            rolled,
            payout
        );
    }

    /// @notice Gets the list of the last user bets.
    /// @param user Address of the gamer.
    /// @param dataLength The amount of bets to return.
    /// @return A list of Dice bet.
    function getLastUserBets(address user, uint256 dataLength)
        external
        view
        returns (FullDiceBet[] memory)
    {
        Bet[] memory lastBets = _getLastUserBets(user, dataLength);
        FullDiceBet[] memory lastDiceBets = new FullDiceBet[](lastBets.length);
        for (uint256 i; i < lastBets.length; i++) {
            lastDiceBets[i] = FullDiceBet(
                lastBets[i],
                diceBets[lastBets[i].id]
            );
        }
        return lastDiceBets;
    }
}

File 15 of 15 : Game.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.16;

import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {Multicall} from "@openzeppelin/contracts/utils/Multicall.sol";
import {Pausable} from "@openzeppelin/contracts/security/Pausable.sol";
import {IERC20, SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";

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

import {IBank} from "../bank/IBank.sol";

// import "hardhat/console.sol";

interface IVRFCoordinatorV2 is VRFCoordinatorV2Interface {
    function getFeeConfig()
        external
        view
        returns (
            uint32,
            uint32,
            uint32,
            uint32,
            uint32,
            uint24,
            uint24,
            uint24,
            uint24
        );
}

/// @title Game base contract
/// @author Romuald Hog
/// @notice This should be parent contract of each games.
/// It defines all the games common functions and state variables.
/// @dev All rates are in basis point. Chainlink VRF v2 is used.
abstract contract Game is
    Ownable,
    Pausable,
    Multicall,
    VRFConsumerBaseV2,
    ReentrancyGuard
{
    using SafeERC20 for IERC20;

    /// @notice Bet information struct.
    /// @param resolved Whether the bet has been resolved.
    /// @param user Address of the gamer.
    /// @param token Address of the token.
    /// @param id Bet ID generated by Chainlink VRF.
    /// @param amount The bet amount.
    /// @param blockNumber Block number of the bet used to refund in case Chainlink's callback fail.
    /// @param payout The payout amount.
    /// @param vrfCost The Chainlink VRF cost paid by player.
    struct Bet {
        bool resolved;
        address payable user;
        address token;
        uint256 id;
        uint256 amount;
        uint256 blockNumber;
        uint256 payout;
        uint256 vrfCost;
    }

    /// @notice Token struct.
    /// @param houseEdge House edge rate.
    /// @param pendingCount Number of pending bets.
    /// @param VRFCallbackGasLimit How much gas is needed in the Chainlink VRF callback.
    /// @param VRFFees Chainlink's VRF collected fees amount.
    struct Token {
        uint16 houseEdge;
        uint64 pendingCount;
        uint32 VRFCallbackGasLimit;
        uint256 VRFFees;
    }

    /// @notice Chainlink VRF configuration struct.
    /// @param requestConfirmations How many confirmations the Chainlink node should wait before responding.
    /// @param numRandomWords How many random words is needed to resolve a game's bet.
    /// @param keyHash Hash of the public key used to verify the VRF proof.
    /// @param chainlinkCoordinator Reference to the VRFCoordinatorV2 deployed contract.
    struct ChainlinkConfig {
        uint16 requestConfirmations;
        uint16 numRandomWords;
        bytes32 keyHash;
        IVRFCoordinatorV2 chainlinkCoordinator;
    }

    /// @notice Chainlink VRF configuration state.
    ChainlinkConfig private _chainlinkConfig;

    /// @notice Chainlink price feed.
    AggregatorV3Interface private immutable _LINK_ETH_feed;

    /// @notice Maps bets IDs to Bet information.
    mapping(uint256 => Bet) public bets;

    /// @notice Maps users addresses to bets IDs
    mapping(address => uint256[]) internal _userBets;

    /// @notice Maps tokens addresses to token configuration.
    mapping(address => Token) public tokens;

    /// @notice The bank that manage to payout a won bet and collect a loss bet.
    IBank public bank;

    /// @notice Emitted after the bank is set.
    /// @param bank Address of the bank contract.
    event SetBank(address bank);

    /// @notice Emitted after the house edge is set for a token.
    /// @param token Address of the token.
    /// @param houseEdge House edge rate.
    event SetHouseEdge(address indexed token, uint16 houseEdge);

    /// @notice Emitted after the Chainlink callback gas limit is set for a token.
    /// @param token Address of the token.
    /// @param callbackGasLimit New Chainlink VRF callback gas limit.
    event SetVRFCallbackGasLimit(
        address indexed token,
        uint32 callbackGasLimit
    );

    /// @notice Emitted after the Chainlink config is set.
    /// @param requestConfirmations How many confirmations the Chainlink node should wait before responding.
    /// @param keyHash Hash of the public key used to verify the VRF proof.
    event SetChainlinkConfig(uint16 requestConfirmations, bytes32 keyHash);

    /// @notice Emitted after the bet amount is transfered to the user.
    /// @param id The bet ID.
    /// @param user Address of the gamer.
    /// @param amount Number of tokens refunded.
    /// @param chainlinkVRFCost The Chainlink VRF cost refunded to player.
    event BetRefunded(
        uint256 id,
        address user,
        uint256 amount,
        uint256 chainlinkVRFCost
    );

    /// @notice Emitted after the token's VRF fees amount is transfered to the user.
    /// @param token Address of the token.
    /// @param amount Number of tokens refunded.
    event DistributeTokenVRFFees(address indexed token, uint256 amount);

    /// @notice Insufficient bet amount.
    /// @param minBetAmount Bet amount.
    error UnderMinBetAmount(uint256 minBetAmount);

    /// @notice Bet provided doesn't exist or was already resolved.
    error NotPendingBet();

    /// @notice Bet isn't resolved yet.
    error NotFulfilled();

    /// @notice House edge is capped at 4%.
    error ExcessiveHouseEdge();

    /// @notice Token is not allowed.
    error ForbiddenToken();

    /// @notice Chainlink price feed not working
    /// @param linkWei LINK/ETH price returned.
    error InvalidLinkWeiPrice(int256 linkWei);

    /// @notice The msg.value is not enough to cover Chainlink's fee.
    error WrongGasValueToCoverFee();

    /// @notice Reverting error when sender isn't allowed.
    error AccessDenied();

    /// @notice Reverting error when provided address isn't valid.
    error InvalidAddress();

    /// @notice Reverting error when bet resolution cost refund to user failed.
    error BetVRFCostRefundFailed();

    /// @notice Reverting error when token has pending bets.
    error TokenHasPendingBets();

    /// @notice Initialize contract's state variables and VRF Consumer.
    /// @param bankAddress The address of the bank.
    /// @param chainlinkCoordinatorAddress Address of the Chainlink VRF Coordinator.
    /// @param numRandomWords How many random words is needed to resolve a game's bet.
    /// @param LINK_ETH_feedAddress Address of the Chainlink LINK/ETH price feed.
    constructor(
        address bankAddress,
        address chainlinkCoordinatorAddress,
        uint16 numRandomWords,
        address LINK_ETH_feedAddress
    ) VRFConsumerBaseV2(chainlinkCoordinatorAddress) {
        if (
            LINK_ETH_feedAddress == address(0) ||
            chainlinkCoordinatorAddress == address(0)
        ) {
            revert InvalidAddress();
        }
        require(
            numRandomWords != 0 && numRandomWords <= 500,
            "Wrong Chainlink NumRandomWords"
        );

        setBank(IBank(bankAddress));
        _chainlinkConfig.chainlinkCoordinator = IVRFCoordinatorV2(
            chainlinkCoordinatorAddress
        );
        _chainlinkConfig.numRandomWords = numRandomWords;
        _LINK_ETH_feed = AggregatorV3Interface(LINK_ETH_feedAddress);
    }

    /// @notice Calculates the amount's fee based on the house edge.
    /// @param token Address of the token.
    /// @param amount From which the fee amount will be calculated.
    /// @return The fee amount.
    function _getFees(address token, uint256 amount)
        private
        view
        returns (uint256)
    {
        return (tokens[token].houseEdge * amount) / 10000;
    }

    /// @notice Creates a new bet and request randomness to Chainlink,
    /// transfer the ERC20 tokens to the contract or refund the bet amount overflow if the bet amount exceed the maxBetAmount.
    /// @param tokenAddress Address of the token.
    /// @param tokenAmount The number of tokens bet.
    /// @param multiplier The bet amount leverage determines the user's profit amount. 10000 = 100% = no profit.
    /// @return A new Bet struct information.
    function _newBet(
        address tokenAddress,
        uint256 tokenAmount,
        uint256 multiplier
    ) internal whenNotPaused nonReentrant returns (Bet memory) {
        Token storage token = tokens[tokenAddress];
        if (
            bank.isAllowedToken(tokenAddress) == false || token.houseEdge == 0
        ) {
            revert ForbiddenToken();
        }

        address user = msg.sender;
        bool isGasToken = tokenAddress == address(0);
        uint256 fee = isGasToken ? (msg.value - tokenAmount) : msg.value;
        uint256 betAmount = isGasToken ? msg.value - fee : tokenAmount;

        // Charge user for Chainlink VRF fee.
        {
            uint256 chainlinkVRFCost = getChainlinkVRFCost(tokenAddress);
            if (fee < (chainlinkVRFCost - ((10 * chainlinkVRFCost) / 100))) {
                // 5% slippage.
                revert WrongGasValueToCoverFee();
            }
            token.VRFFees += fee;
        }

        // Bet amount is capped.
        {
            uint256 minBetAmount = bank.getMinBetAmount(tokenAddress);
            if (betAmount < minBetAmount) {
                revert UnderMinBetAmount(minBetAmount);
            }

            uint256 maxBetAmount = bank.getMaxBetAmount(
                tokenAddress,
                multiplier
            );
            if (betAmount > maxBetAmount) {
                if (isGasToken) {
                    payable(user).transfer(betAmount - maxBetAmount);
                }
                betAmount = maxBetAmount;
            }
        }

        // Create bet
        uint256 id = _chainlinkConfig.chainlinkCoordinator.requestRandomWords(
            _chainlinkConfig.keyHash,
            bank.getVRFSubId(tokenAddress),
            _chainlinkConfig.requestConfirmations,
            token.VRFCallbackGasLimit,
            _chainlinkConfig.numRandomWords
        );
        Bet memory newBet = Bet(
            false,
            payable(user),
            tokenAddress,
            id,
            betAmount,
            block.number,
            0,
            fee
        );
        _userBets[user].push(id);
        bets[id] = newBet;
        token.pendingCount++;

        // If ERC20, transfer the tokens
        if (!isGasToken) {
            IERC20(tokenAddress).safeTransferFrom(
                user,
                address(this),
                betAmount
            );
        }

        return newBet;
    }

    /// @notice Resolves the bet based on the game child contract result.
    /// In case bet is won, the bet amount minus the house edge is transfered to user from the game contract, and the profit is transfered to the user from the Bank.
    /// In case bet is lost, the bet amount is transfered to the Bank from the game contract.
    /// @param bet The Bet struct information.
    /// @param wins Whether the bet is winning.
    /// @param payout What should be sent to the user in case of a won bet. Payout = bet amount + profit amount.
    /// @return The payout amount.
    /// @dev Should not revert as it resolves the bet with the randomness.
    function _resolveBet(
        Bet storage bet,
        bool wins,
        uint256 payout
    ) internal returns (uint256) {
        if (bet.resolved == true || bet.user == address(0)) {
            revert NotPendingBet();
        }
        bet.resolved = true;

        address token = bet.token;
        tokens[token].pendingCount--;

        uint256 betAmount = bet.amount;
        bool isGasToken = bet.token == address(0);
        // Check for the result
        if (wins) {
            address payable user = bet.user;

            uint256 profit = payout - betAmount;
            uint256 betAmountFee = _getFees(token, betAmount);
            uint256 profitFee = _getFees(token, profit);
            uint256 fee = betAmountFee + profitFee;

            payout -= fee;

            uint256 betAmountPayout = betAmount - betAmountFee;
            uint256 profitPayout = profit - profitFee;
            // Transfer the bet amount payout to the player
            if (isGasToken) {
                user.transfer(betAmountPayout);
            } else {
                IERC20(token).safeTransfer(user, betAmountPayout);
                // Transfer the bet amount fee to the bank.
                IERC20(token).safeTransfer(address(bank), betAmountFee);
            }

            // Transfer the payout from the bank, the bet amount fee to the bank, and account fees.
            bank.payout{value: isGasToken ? betAmountFee : 0}(
                user,
                token,
                profitPayout,
                fee
            );
        } else {
            payout = 0;
            if (!isGasToken) {
                IERC20(token).safeTransfer(address(bank), betAmount);
            }
            bank.cashIn{value: isGasToken ? betAmount : 0}(token, betAmount);
        }

        bet.payout = payout;
        return payout;
    }

    /// @notice Gets the list of the last user bets.
    /// @param user Address of the gamer.
    /// @param dataLength The amount of bets to return.
    /// @return A list of Bet.
    function _getLastUserBets(address user, uint256 dataLength)
        internal
        view
        returns (Bet[] memory)
    {
        uint256[] memory userBetsIds = _userBets[user];
        uint256 betsLength = userBetsIds.length;

        if (betsLength < dataLength) {
            dataLength = betsLength;
        }

        Bet[] memory userBets = new Bet[](dataLength);
        if (dataLength != 0) {
            uint256 userBetsIndex;
            for (uint256 i = betsLength; i > betsLength - dataLength; i--) {
                userBets[userBetsIndex] = bets[userBetsIds[i - 1]];
                userBetsIndex++;
            }
        }

        return userBets;
    }

    /// @notice Sets the game house edge rate for a specific token.
    /// @param token Address of the token.
    /// @param houseEdge House edge rate.
    /// @dev The house edge rate couldn't exceed 4%.
    function setHouseEdge(address token, uint16 houseEdge) external onlyOwner {
        if (houseEdge > 400) {
            revert ExcessiveHouseEdge();
        }
        if (hasPendingBets(token)) {
            revert TokenHasPendingBets();
        }
        tokens[token].houseEdge = houseEdge;
        emit SetHouseEdge(token, houseEdge);
    }

    /// @notice Pauses the contract to disable new bets.
    function pause() external onlyOwner {
        if (paused()) {
            _unpause();
        } else {
            _pause();
        }
    }

    /// @notice Sets the Chainlink VRF V2 configuration.
    /// @param requestConfirmations How many confirmations the Chainlink node should wait before responding.
    /// @param keyHash Hash of the public key used to verify the VRF proof.
    function setChainlinkConfig(uint16 requestConfirmations, bytes32 keyHash)
        external
        onlyOwner
    {
        _chainlinkConfig.requestConfirmations = requestConfirmations;
        _chainlinkConfig.keyHash = keyHash;
        emit SetChainlinkConfig(requestConfirmations, keyHash);
    }

    /// @notice Sets the Chainlink VRF V2 configuration.
    /// @param callbackGasLimit How much gas is needed in the Chainlink VRF callback.
    function setVRFCallbackGasLimit(address token, uint32 callbackGasLimit)
        external
        onlyOwner
    {
        tokens[token].VRFCallbackGasLimit = callbackGasLimit;
        emit SetVRFCallbackGasLimit(token, callbackGasLimit);
    }

    /// @notice Distributes the token's collected Chainlink fees.
    /// @param token Address of the token.
    function withdrawTokensVRFFees(address token) external {
        uint256 tokenChainlinkFees = tokens[token].VRFFees;
        if (tokenChainlinkFees != 0) {
            delete tokens[token].VRFFees;
            payable(bank.getTokenOwner(token)).transfer(tokenChainlinkFees);
            emit DistributeTokenVRFFees(token, tokenChainlinkFees);
        }
    }

    /// @notice Refunds the bet to the user if the Chainlink VRF callback failed.
    /// @param id The Bet ID.
    function refundBet(uint256 id) external nonReentrant {
        Bet storage bet = bets[id];
        if (bet.resolved == true) {
            revert NotPendingBet();
        } else if (block.number < bet.blockNumber + 30) {
            revert NotFulfilled();
        }

        Token storage token = tokens[bet.token];
        token.pendingCount--;

        bet.resolved = true;
        bet.payout = bet.amount;

        if (bet.token == address(0)) {
            payable(bet.user).transfer(bet.amount);
        } else {
            IERC20(bet.token).safeTransfer(bet.user, bet.amount);
        }

        uint256 chainlinkVRFCost = bet.vrfCost;
        if (
            token.VRFFees >= chainlinkVRFCost &&
            address(this).balance >= chainlinkVRFCost
        ) {
            token.VRFFees -= chainlinkVRFCost;
            payable(bet.user).transfer(chainlinkVRFCost);
            emit BetRefunded(id, bet.user, bet.amount, chainlinkVRFCost);
        } else {
            revert BetVRFCostRefundFailed();
        }
    }

    /// @notice Returns the Chainlink VRF config.
    /// @param requestConfirmations How many confirmations the Chainlink node should wait before responding.
    /// @param keyHash Hash of the public key used to verify the VRF proof.
    /// @param chainlinkCoordinator Reference to the VRFCoordinatorV2 deployed contract.
    function getChainlinkConfig()
        external
        view
        returns (
            uint16 requestConfirmations,
            bytes32 keyHash,
            IVRFCoordinatorV2 chainlinkCoordinator
        )
    {
        return (
            _chainlinkConfig.requestConfirmations,
            _chainlinkConfig.keyHash,
            _chainlinkConfig.chainlinkCoordinator
        );
    }

    /// @notice Returns whether the token has pending bets.
    /// @return Whether the token has pending bets.
    function hasPendingBets(address token) public view returns (bool) {
        return tokens[token].pendingCount != 0;
    }

    /// @notice Sets the Bank contract.
    /// @param _bank Address of the Bank contract.
    function setBank(IBank _bank) public onlyOwner {
        if (address(_bank) == address(0)) {
            revert InvalidAddress();
        }
        bank = _bank;
        emit SetBank(address(_bank));
    }

    /// @notice Returns the amount of ETH that should be passed to the wager transaction.
    /// to cover Chainlink VRF fee.
    /// @return The bet resolution cost amount.
    function getChainlinkVRFCost(address token) public view returns (uint256) {
        (, int256 weiPerUnitLink, , , ) = _LINK_ETH_feed.latestRoundData();
        if (weiPerUnitLink <= 0) {
            revert InvalidLinkWeiPrice(weiPerUnitLink);
        }
        // Get Chainlink VRF v2 fee amount.
        (
            uint32 fulfillmentFlatFeeLinkPPMTier1,
            ,
            ,
            ,
            ,
            ,
            ,
            ,

        ) = _chainlinkConfig.chainlinkCoordinator.getFeeConfig();
        // 115000 gas is the average Verification gas of Chainlink VRF.
        return
            (tx.gasprice * (115000 + tokens[token].VRFCallbackGasLimit)) +
            ((1e12 *
                uint256(fulfillmentFlatFeeLinkPPMTier1) *
                uint256(weiPerUnitLink)) / 1e18);
    }
}

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

Contract ABI

[{"inputs":[{"internalType":"address","name":"bankAddress","type":"address"},{"internalType":"address","name":"chainlinkCoordinatorAddress","type":"address"},{"internalType":"address","name":"LINK_ETH_feedAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessDenied","type":"error"},{"inputs":[],"name":"BetVRFCostRefundFailed","type":"error"},{"inputs":[{"internalType":"uint8","name":"minCap","type":"uint8"},{"internalType":"uint8","name":"maxCap","type":"uint8"}],"name":"CapNotInRange","type":"error"},{"inputs":[],"name":"ExcessiveHouseEdge","type":"error"},{"inputs":[],"name":"ForbiddenToken","type":"error"},{"inputs":[],"name":"InvalidAddress","type":"error"},{"inputs":[{"internalType":"int256","name":"linkWei","type":"int256"}],"name":"InvalidLinkWeiPrice","type":"error"},{"inputs":[],"name":"NotFulfilled","type":"error"},{"inputs":[],"name":"NotPendingBet","type":"error"},{"inputs":[{"internalType":"address","name":"have","type":"address"},{"internalType":"address","name":"want","type":"address"}],"name":"OnlyCoordinatorCanFulfill","type":"error"},{"inputs":[],"name":"TokenHasPendingBets","type":"error"},{"inputs":[{"internalType":"uint256","name":"minBetAmount","type":"uint256"}],"name":"UnderMinBetAmount","type":"error"},{"inputs":[],"name":"WrongGasValueToCoverFee","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"chainlinkVRFCost","type":"uint256"}],"name":"BetRefunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"DistributeTokenVRFFees","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"vrfCost","type":"uint256"},{"indexed":false,"internalType":"uint8","name":"cap","type":"uint8"}],"name":"PlaceBet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint8","name":"cap","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"rolled","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"payout","type":"uint256"}],"name":"Roll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"bank","type":"address"}],"name":"SetBank","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"requestConfirmations","type":"uint16"},{"indexed":false,"internalType":"bytes32","name":"keyHash","type":"bytes32"}],"name":"SetChainlinkConfig","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint16","name":"houseEdge","type":"uint16"}],"name":"SetHouseEdge","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint32","name":"callbackGasLimit","type":"uint32"}],"name":"SetVRFCallbackGasLimit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"bank","outputs":[{"internalType":"contract IBank","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"bets","outputs":[{"internalType":"bool","name":"resolved","type":"bool"},{"internalType":"address payable","name":"user","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"blockNumber","type":"uint256"},{"internalType":"uint256","name":"payout","type":"uint256"},{"internalType":"uint256","name":"vrfCost","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"diceBets","outputs":[{"internalType":"uint8","name":"cap","type":"uint8"},{"internalType":"uint8","name":"rolled","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getChainlinkConfig","outputs":[{"internalType":"uint16","name":"requestConfirmations","type":"uint16"},{"internalType":"bytes32","name":"keyHash","type":"bytes32"},{"internalType":"contract IVRFCoordinatorV2","name":"chainlinkCoordinator","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getChainlinkVRFCost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"dataLength","type":"uint256"}],"name":"getLastUserBets","outputs":[{"components":[{"components":[{"internalType":"bool","name":"resolved","type":"bool"},{"internalType":"address payable","name":"user","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"blockNumber","type":"uint256"},{"internalType":"uint256","name":"payout","type":"uint256"},{"internalType":"uint256","name":"vrfCost","type":"uint256"}],"internalType":"struct Game.Bet","name":"bet","type":"tuple"},{"components":[{"internalType":"uint8","name":"cap","type":"uint8"},{"internalType":"uint8","name":"rolled","type":"uint8"}],"internalType":"struct Dice.DiceBet","name":"diceBet","type":"tuple"}],"internalType":"struct Dice.FullDiceBet[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"hasPendingBets","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":"uint256","name":"id","type":"uint256"}],"name":"refundBet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IBank","name":"_bank","type":"address"}],"name":"setBank","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"requestConfirmations","type":"uint16"},{"internalType":"bytes32","name":"keyHash","type":"bytes32"}],"name":"setChainlinkConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint16","name":"houseEdge","type":"uint16"}],"name":"setHouseEdge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint32","name":"callbackGasLimit","type":"uint32"}],"name":"setVRFCallbackGasLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokens","outputs":[{"internalType":"uint16","name":"houseEdge","type":"uint16"},{"internalType":"uint64","name":"pendingCount","type":"uint64"},{"internalType":"uint32","name":"VRFCallbackGasLimit","type":"uint32"},{"internalType":"uint256","name":"VRFFees","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"cap","type":"uint8"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"wager","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"withdrawTokensVRFFees","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60c06040523480156200001157600080fd5b50604051620035f5380380620035f58339810160408190526200003491620002ad565b82826001838262000045336200015c565b6000805460ff60a01b191690556001600160a01b0390811660805260018055811615806200007a57506001600160a01b038316155b15620000995760405163e6c4247b60e01b815260040160405180910390fd5b61ffff821615801590620000b357506101f48261ffff1611155b620001055760405162461bcd60e51b815260206004820152601e60248201527f57726f6e6720436861696e6c696e6b204e756d52616e646f6d576f726473000060448201526064015b60405180910390fd5b6200011084620001ac565b600480546001600160a01b039485166001600160a01b03199091161790556002805461ffff909316620100000263ffff000019909316929092179091551660a05250620002f792505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b620001b662000232565b6001600160a01b038116620001de5760405163e6c4247b60e01b815260040160405180910390fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f10f5824683d64a0712038f2244e046b174a1cc57fbb8556bfda5ffb2612440679060200160405180910390a150565b6000546001600160a01b031633146200028e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401620000fc565b565b80516001600160a01b0381168114620002a857600080fd5b919050565b600080600060608486031215620002c357600080fd5b620002ce8462000290565b9250620002de6020850162000290565b9150620002ee6040850162000290565b90509250925092565b60805160a0516132d1620003246000396000610b400152600081816106c7015261072201526132d16000f3fe6080604052600436106101755760003560e01c80637d0807d7116100cb578063ac9650d81161007f578063e32fe50411610059578063e32fe5041461052e578063e48603391461054e578063f2fde38b146105e857600080fd5b8063ac9650d8146104b4578063c2fb579f146104e1578063e1fdb4b41461050e57600080fd5b80638da5cb5b116100b05780638da5cb5b14610448578063982c3fdd14610466578063a23cd7df1461049457600080fd5b80637d0807d7146103f45780638456cb591461043357600080fd5b8063594043fd1161012d578063715018a611610107578063715018a61461038757806376cdb03b1461039c57806378bcde22146103d457600080fd5b8063594043fd146102df5780635c975abb14610337578063707cd55e1461036757600080fd5b806322af00fa1161015e57806322af00fa146101bc5780634031e85b1461027957806342258eca1461028c57600080fd5b8063090d23b91461017a5780631fe543e31461019c575b600080fd5b34801561018657600080fd5b5061019a610195366004612970565b610608565b005b3480156101a857600080fd5b5061019a6101b73660046129bc565b6106bc565b3480156101c857600080fd5b5061022b6101d7366004612aa4565b6005602081905260009182526040909120805460018201546002830154600384015460048501549585015460069095015460ff8516966101009095046001600160a01b039081169694169492939192919088565b6040805198151589526001600160a01b0397881660208a015295909616948701949094526060860192909252608085015260a084015260c083015260e0820152610100015b60405180910390f35b61019a610287366004612abd565b610762565b34801561029857600080fd5b506102c56102a7366004612aa4565b60096020526000908152604090205460ff8082169161010090041682565b6040805160ff938416815292909116602083015201610270565b3480156102eb57600080fd5b506103276102fa366004612970565b6001600160a01b031660009081526007602052604090205462010000900467ffffffffffffffff16151590565b6040519015158152602001610270565b34801561034357600080fd5b5060005474010000000000000000000000000000000000000000900460ff16610327565b34801561037357600080fd5b5061019a610382366004612970565b61088b565b34801561039357600080fd5b5061019a6109cc565b3480156103a857600080fd5b506008546103bc906001600160a01b031681565b6040516001600160a01b039091168152602001610270565b3480156103e057600080fd5b5061019a6103ef366004612b1b565b6109e0565b34801561040057600080fd5b506002546003546004546040805161ffff909416845260208401929092526001600160a01b031690820152606001610270565b34801561043f57600080fd5b5061019a610b00565b34801561045457600080fd5b506000546001600160a01b03166103bc565b34801561047257600080fd5b50610486610481366004612970565b610b3b565b604051908152602001610270565b3480156104a057600080fd5b5061019a6104af366004612b50565b610d27565b3480156104c057600080fd5b506104d46104cf366004612b7a565b610da2565b6040516102709190612c5d565b3480156104ed57600080fd5b506105016104fc366004612cdd565b610e98565b6040516102709190612cfb565b34801561051a57600080fd5b5061019a610529366004612aa4565b611022565b34801561053a57600080fd5b5061019a610549366004612dc7565b611339565b34801561055a57600080fd5b506105af610569366004612970565b6007602052600090815260409020805460019091015461ffff82169162010000810467ffffffffffffffff16916a010000000000000000000090910463ffffffff169084565b6040805161ffff909516855267ffffffffffffffff909316602085015263ffffffff909116918301919091526060820152608001610270565b3480156105f457600080fd5b5061019a610603366004612970565b6113cb565b61061061145b565b6001600160a01b038116610650576040517fe6c4247b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600880547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0383169081179091556040519081527f10f5824683d64a0712038f2244e046b174a1cc57fbb8556bfda5ffb2612440679060200160405180910390a150565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610754576040517f1cf993f40000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001660248201526044015b60405180910390fd5b61075e82826114b5565b5050565b61076a6115e9565b60ff8316158061077d575060638360ff16115b156107be576040517f8a4b39a7000000000000000000000000000000000000000000000000000000008152600160048201526063602482015260440161074b565b60006107d683836107d161271088611654565b611680565b6060818101805160009081526009602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660ff8b169081179091558286015182870151945160808089015160e08a015187519384529583015294810193909352948201529394506001600160a01b039283169392909116917f26f00ccf4a53c10f46f9e750cfb709eb6a2beba8fab751d9d2a2d99feadaaf58910160405180910390a350505050565b6001600160a01b038116600090815260076020526040902060010154801561075e576001600160a01b038281166000818152600760205260408082206001019190915560085490517fdc17c9ca00000000000000000000000000000000000000000000000000000000815260048101929092529091169063dc17c9ca90602401602060405180830381865afa158015610928573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061094c9190612e00565b6001600160a01b03166108fc829081150290604051600060405180830381858888f19350505050158015610984573d6000803e3d6000fd5b50816001600160a01b03167f1d3f9fc0810d9e182e982399cb91de735f6c415728fb9bc42664b84087c2af56826040516109c091815260200190565b60405180910390a25050565b6109d461145b565b6109de6000611dc4565b565b6109e861145b565b6101908161ffff161115610a28576040517f70b5774c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03821660009081526007602052604090205462010000900467ffffffffffffffff1615610a88576040517faa4256e000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03821660008181526007602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001661ffff861690811790915591519182527f7dfd3ecb8ac83242184c019f85ca408558f2ac0a5a19af6be2a4aee697eac81291016109c0565b610b0861145b565b60005474010000000000000000000000000000000000000000900460ff1615610b33576109de611e2c565b6109de611e9c565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015610b9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc09190612e37565b50505091505060008113610c03576040517f43d4cf660000000000000000000000000000000000000000000000000000000081526004810182905260240161074b565b60048054604080517f5fbbc0d200000000000000000000000000000000000000000000000000000000815290516000936001600160a01b0390931692635fbbc0d292808201926101209290918290030181865afa158015610c68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c8c9190612e9a565b50505050505050509050670de0b6b3a7640000828263ffffffff1664e8d4a51000610cb79190612f7f565b610cc19190612f7f565b610ccb9190612feb565b6001600160a01b038516600090815260076020526040902054610d05906a0100000000000000000000900463ffffffff166201c138612fff565b610d159063ffffffff163a612f7f565b610d1f919061301c565b949350505050565b610d2f61145b565b600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001661ffff8416908117909155600382905560408051918252602082018390527f312eab8f28128692f3404f828c413db540bc15a246c46d0b40e3c004b947c437910160405180910390a15050565b60608167ffffffffffffffff811115610dbd57610dbd61298d565b604051908082528060200260200182016040528015610df057816020015b6060815260200190600190039081610ddb5790505b50905060005b82811015610e9057610e6030858584818110610e1457610e1461302f565b9050602002810190610e26919061305e565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611f0b92505050565b828281518110610e7257610e7261302f565b60200260200101819052508080610e88906130ca565b915050610df6565b505b92915050565b60606000610ea68484611f30565b90506000815167ffffffffffffffff811115610ec457610ec461298d565b604051908082528060200260200182016040528015610f5757816020015b60408051610140810182526000818301818152606083018290526080830182905260a0830182905260c0830182905260e083018290526101008301829052610120830182905282528251808401909352808352602080840191909152810191909152815260200190600190039081610ee25790505b50905060005b8251811015611019576040518060400160405280848381518110610f8357610f8361302f565b6020026020010151815260200160096000868581518110610fa657610fa661302f565b60209081029190910181015160600151825281810192909252604090810160002081518083019092525460ff8082168352610100909104169181019190915290528251839083908110610ffb57610ffb61302f565b60200260200101819052508080611011906130ca565b915050610f5d565b50949350505050565b6002600154036110745760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161074b565b6002600190815560008281526005602052604090208054909160ff909116151590036110cc576040517f21abe57a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60048101546110dc90601e61301c565b431015611115576040517f07bc6c3e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60018101546001600160a01b03166000908152600760205260409020805462010000900467ffffffffffffffff1681600261114f83613102565b825467ffffffffffffffff9182166101009390930a92830291909202199091161790555081547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660019081178355600383015460058401558201546001600160a01b03166111ff57815460038301546040516101009092046001600160a01b0316916108fc82150291906000818181858888f193505050501580156111f9573d6000803e3d6000fd5b5061122a565b81546003830154600184015461122a926001600160a01b03918216926101009091049091169061215b565b6006820154600182015481118015906112435750804710155b156112fd578082600101600082825461125c9190613144565b909155505082546040516101009091046001600160a01b0316906108fc8315029083906000818181858888f1935050505015801561129e573d6000803e3d6000fd5b5082546003840154604080518781526101009093046001600160a01b03166020840152820152606081018290527fe282fd838bb937af0c0f54e49ba5f86229ed0c90344c3cc4e2135cb673493e699060800160405180910390a161132f565b6040517fb0ee34b600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050600180555050565b61134161145b565b6001600160a01b03821660008181526007602090815260409182902080547fffffffffffffffffffffffffffffffffffff00000000ffffffffffffffffffff166a010000000000000000000063ffffffff87169081029190911790915591519182527f9edb52532d26512950c91a14b132f6df3cd06bfb49e795e03e56736121cd24a891016109c0565b6113d361145b565b6001600160a01b03811661144f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161074b565b61145881611dc4565b50565b6000546001600160a01b031633146109de5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161074b565b600082815260096020908152604080832060059092528220835191929091606490859083906114e6576114e661302f565b60200260200101516114f89190613157565b61150390600161301c565b835460ff80831661010081027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff84168117885560038701549495506000946115639488949283169216919091179182109161155e9190611654565b612227565b6001840154845460028601546003870154885460408051938452602084019290925260ff908116838301528716606083015260808201859052519394506001600160a01b0392831693610100909204909216917f326deeefddbbeec0f2c3cabe67c30b881c1328c2208cf3541243d3cb67472249919081900360a00190a3505050505050565b60005474010000000000000000000000000000000000000000900460ff16156109de5760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a2070617573656400000000000000000000000000000000604482015260640161074b565b600061166182606461316b565b60ff1661166f846064612f7f565b6116799190612feb565b9392505050565b6116dc60405180610100016040528060001515815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160008152602001600081526020016000815260200160008152602001600081525090565b6116e46115e9565b6002600154036117365760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161074b565b60026001556001600160a01b038481166000818152600760205260409081902060085491517fcbe230c3000000000000000000000000000000000000000000000000000000008152600481019390935292169063cbe230c390602401602060405180830381865afa1580156117af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117d39190613184565b15806117e25750805461ffff16155b15611819576040517fc455905500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336001600160a01b03861615600081611832573461183c565b61183c8734613144565b905060008261184b5787611855565b6118558234613144565b905060006118628a610b3b565b9050606461187182600a612f7f565b61187b9190612feb565b6118859082613144565b8310156118be576040517f0b56cefe00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b828660010160008282546118d2919061301c565b90915550506008546040517ff6b2a2f10000000000000000000000000000000000000000000000000000000081526001600160a01b038c81166004830152600093509091169063f6b2a2f190602401602060405180830381865afa15801561193e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061196291906131a6565b9050808210156119a1576040517f022558f40000000000000000000000000000000000000000000000000000000081526004810182905260240161074b565b6008546040517f278b39de0000000000000000000000000000000000000000000000000000000081526001600160a01b038c81166004830152602482018b9052600092169063278b39de90604401602060405180830381865afa158015611a0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a3091906131a6565b905080831115611a85578415611a81576001600160a01b0386166108fc611a578386613144565b6040518115909202916000818181858888f19350505050158015611a7f573d6000803e3d6000fd5b505b8092505b5050600480546003546008546040517f279e34150000000000000000000000000000000000000000000000000000000081526001600160a01b038e81169582019590955260009493841693635d3b1d309392169063279e341590602401602060405180830381865afa158015611aff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b2391906131bf565b6002548a5460405160e086901b7fffffffff00000000000000000000000000000000000000000000000000000000168152600481019490945267ffffffffffffffff909216602484015261ffff80821660448501526a010000000000000000000090920463ffffffff16606484015262010000900416608482015260a4016020604051808303816000875af1158015611bc0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611be491906131a6565b90506000604051806101000160405280600015158152602001876001600160a01b031681526020018c6001600160a01b031681526020018381526020018481526020014381526020016000815260200185815250905060066000876001600160a01b03166001600160a01b03168152602001908152602001600020829080600181540180825580915050600190039060005260206000200160009091909190915055806005600084815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160010160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550606082015181600201556080820151816003015560a0820151816004015560c0820151816005015560e0820151816006015590505086600001600281819054906101000a900467ffffffffffffffff1680929190611d71906131e9565b91906101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055505084611db257611db26001600160a01b038c16873086612581565b600180559a9950505050505050505050565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b611e346125d8565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b611ea46115e9565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611e7f3390565b6060611679838360405180606001604052806027815260200161327560279139612642565b6001600160a01b0382166000908152600660209081526040808320805482518185028101850190935280835260609493830182828015611f8f57602002820191906000526020600020905b815481526020019060010190808311611f7b575b5050835193945050505083811015611fa5578093505b60008467ffffffffffffffff811115611fc057611fc061298d565b60405190808252806020026020018201604052801561204d57816020015b61203a60405180610100016040528060001515815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160008152602001600081526020016000815260200160008152602001600081525090565b815260200190600190039081611fde5790505b5090508415612152576000825b6120648785613144565b81111561214f57600560008661207b600185613144565b8151811061208b5761208b61302f565b602090810291909101810151825281810192909252604090810160002081516101008082018452825460ff811615158352046001600160a01b03908116948201949094526001820154909316918301919091526002810154606083015260038101546080830152600481015460a0830152600581015460c08301526006015460e082015283518490849081106121235761212361302f565b60200260200101819052508180612139906130ca565b925050808061214790613210565b91505061205a565b50505b95945050505050565b6040516001600160a01b0383166024820152604481018290526122229084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612736565b505050565b825460009060ff1615156001148061224c5750835461010090046001600160a01b0316155b15612283576040517f21abe57a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b83547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811785558401546001600160a01b03166000818152600760205260409020805467ffffffffffffffff62010000909104169060026122e783613102565b825467ffffffffffffffff9182166101009390930a928302919092021990911617905550600385015460018601546001600160a01b03161585156124b657865461010090046001600160a01b031660006123418488613144565b9050600061234f868661281b565b9050600061235d878461281b565b9050600061236b828461301c565b9050612377818b613144565b995060006123858489613144565b905060006123938487613144565b905087156123d7576040516001600160a01b0388169083156108fc029084906000818181858888f193505050501580156123d1573d6000803e3d6000fd5b50612405565b6123eb6001600160a01b038b16888461215b565b600854612405906001600160a01b038c811691168761215b565b6008546001600160a01b0316631f61502389612422576000612424565b865b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526001600160a01b03808c1660048301528e16602482015260448101859052606481018790526084016000604051808303818588803b15801561249157600080fd5b505af11580156124a5573d6000803e3d6000fd5b505050505050505050505050612570565b60009450806124d9576008546124d9906001600160a01b0385811691168461215b565b6008546001600160a01b0316633138809d826124f65760006124f8565b835b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526001600160a01b0387166004820152602481018690526044016000604051808303818588803b15801561255657600080fd5b505af115801561256a573d6000803e3d6000fd5b50505050505b505050506005929092018290555090565b6040516001600160a01b03808516602483015283166044820152606481018290526125d29085907f23b872dd00000000000000000000000000000000000000000000000000000000906084016121a0565b50505050565b60005474010000000000000000000000000000000000000000900460ff166109de5760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f7420706175736564000000000000000000000000604482015260640161074b565b60606001600160a01b0384163b6126c15760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161074b565b600080856001600160a01b0316856040516126dc9190613245565b600060405180830381855af49150503d8060008114612717576040519150601f19603f3d011682016040523d82523d6000602084013e61271c565b606091505b509150915061272c828286612847565b9695505050505050565b600061278b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166128809092919063ffffffff16565b80519091501561222257808060200190518101906127a99190613184565b6122225760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161074b565b6001600160a01b0382166000908152600760205260408120546127109061166f90849061ffff16612f7f565b60608315612856575081611679565b8251156128665782518084602001fd5b8160405162461bcd60e51b815260040161074b9190613261565b6060610d1f8484600085856001600160a01b0385163b6128e25760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161074b565b600080866001600160a01b031685876040516128fe9190613245565b60006040518083038185875af1925050503d806000811461293b576040519150601f19603f3d011682016040523d82523d6000602084013e612940565b606091505b5091509150612950828286612847565b979650505050505050565b6001600160a01b038116811461145857600080fd5b60006020828403121561298257600080fd5b81356116798161295b565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080604083850312156129cf57600080fd5b8235915060208084013567ffffffffffffffff808211156129ef57600080fd5b818601915086601f830112612a0357600080fd5b813581811115612a1557612a1561298d565b8060051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f83011681018181108582111715612a5857612a5861298d565b604052918252848201925083810185019189831115612a7657600080fd5b938501935b82851015612a9457843584529385019392850192612a7b565b8096505050505050509250929050565b600060208284031215612ab657600080fd5b5035919050565b600080600060608486031215612ad257600080fd5b833560ff81168114612ae357600080fd5b92506020840135612af38161295b565b929592945050506040919091013590565b803561ffff81168114612b1657600080fd5b919050565b60008060408385031215612b2e57600080fd5b8235612b398161295b565b9150612b4760208401612b04565b90509250929050565b60008060408385031215612b6357600080fd5b612b6c83612b04565b946020939093013593505050565b60008060208385031215612b8d57600080fd5b823567ffffffffffffffff80821115612ba557600080fd5b818501915085601f830112612bb957600080fd5b813581811115612bc857600080fd5b8660208260051b8501011115612bdd57600080fd5b60209290920196919550909350505050565b60005b83811015612c0a578181015183820152602001612bf2565b50506000910152565b60008151808452612c2b816020860160208601612bef565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015612cd0577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0888603018452612cbe858351612c13565b94509285019290850190600101612c84565b5092979650505050505050565b60008060408385031215612cf057600080fd5b8235612b6c8161295b565b602080825282518282018190526000919060409081850190868401855b82811015612da85781518051805115158652878101516001600160a01b0390811689880152878201511687870152606080820151908701526080808201519087015260a0808201519087015260c0808201519087015260e09081015190860152860151805160ff908116610100870152602090910151166101208501526101409093019290850190600101612d18565b5091979650505050505050565b63ffffffff8116811461145857600080fd5b60008060408385031215612dda57600080fd5b8235612de58161295b565b91506020830135612df581612db5565b809150509250929050565b600060208284031215612e1257600080fd5b81516116798161295b565b805169ffffffffffffffffffff81168114612b1657600080fd5b600080600080600060a08688031215612e4f57600080fd5b612e5886612e1d565b9450602086015193506040860151925060608601519150612e7b60808701612e1d565b90509295509295909350565b805162ffffff81168114612b1657600080fd5b60008060008060008060008060006101208a8c031215612eb957600080fd5b8951612ec481612db5565b60208b0151909950612ed581612db5565b60408b0151909850612ee681612db5565b60608b0151909750612ef781612db5565b60808b0151909650612f0881612db5565b9450612f1660a08b01612e87565b9350612f2460c08b01612e87565b9250612f3260e08b01612e87565b9150612f416101008b01612e87565b90509295985092959850929598565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612fb757612fb7612f50565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600082612ffa57612ffa612fbc565b500490565b63ffffffff818116838216019080821115610e9057610e90612f50565b80820180821115610e9257610e92612f50565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261309357600080fd5b83018035915067ffffffffffffffff8211156130ae57600080fd5b6020019150368190038213156130c357600080fd5b9250929050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036130fb576130fb612f50565b5060010190565b600067ffffffffffffffff82168061311c5761311c612f50565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0192915050565b81810381811115610e9257610e92612f50565b60008261316657613166612fbc565b500690565b60ff8281168282160390811115610e9257610e92612f50565b60006020828403121561319657600080fd5b8151801515811461167957600080fd5b6000602082840312156131b857600080fd5b5051919050565b6000602082840312156131d157600080fd5b815167ffffffffffffffff8116811461167957600080fd5b600067ffffffffffffffff80831681810361320657613206612f50565b6001019392505050565b60008161321f5761321f612f50565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b60008251613257818460208701612bef565b9190910192915050565b6020815260006116796020830184612c1356fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212206105e2fa1d0824d92619b91dadefdcab68856b83614af27e75972baae36984b564736f6c634300081000330000000000000000000000003f6bcd0761871ce301cac4c7984b0105adb737ce0000000000000000000000007a1bac17ccc5b313516c5e16fb24f7659aa5ebed00000000000000000000000012162c3e810393dec01362abf156d7ecf6159528

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

0000000000000000000000003f6bcd0761871ce301cac4c7984b0105adb737ce0000000000000000000000007a1bac17ccc5b313516c5e16fb24f7659aa5ebed00000000000000000000000012162c3e810393dec01362abf156d7ecf6159528

-----Decoded View---------------
Arg [0] : bankAddress (address): 0x3f6bcd0761871ce301cac4c7984b0105adb737ce
Arg [1] : chainlinkCoordinatorAddress (address): 0x7a1bac17ccc5b313516c5e16fb24f7659aa5ebed
Arg [2] : LINK_ETH_feedAddress (address): 0x12162c3e810393dec01362abf156d7ecf6159528

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000003f6bcd0761871ce301cac4c7984b0105adb737ce
Arg [1] : 0000000000000000000000007a1bac17ccc5b313516c5e16fb24f7659aa5ebed
Arg [2] : 00000000000000000000000012162c3e810393dec01362abf156d7ecf6159528


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