Contract 0xEe38613Ef276249FD1D817efB432916c88317313

Contract Overview

Balance:
0.388982441516717681 AVAX
Txn Hash Method
Block
From
To
Value [Txn Fee]
0xc84f696f04b5f74cfdc36fa2d9fe401558b56eac10ab6028ecb385f0ea018168Wager143027262022-10-05 3:08:032 days 3 hrs ago0x05404b6f8990a4108150366adb572a870b137edc IN 0xee38613ef276249fd1d817efb432916c883173130.013649935008665 AVAX0.0096019 27.5
0x4f65c069d6f603d6b95187c25b2819264698e08374f6cb59da1637779eb97207Wager136074072022-09-17 13:52:1919 days 16 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN 0xee38613ef276249fd1d817efb432916c883173130.023570380285557 AVAX0.0081615495 26.5
0xc88eac53421eedc28932f1a56a963ed514e45aed6f6dd78a55c79cba1243c7fdWager136073942022-09-17 13:51:5119 days 16 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN 0xee38613ef276249fd1d817efb432916c883173130.023570380285557 AVAX0.008007558 26
0xa74d5a189e0296908e114c0509b7e54a793ce54497164877ede5a5b0e903b47eWager136073702022-09-17 13:50:3919 days 16 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN 0xee38613ef276249fd1d817efb432916c883173130.023570380285557 AVAX0.008007558 26
0x45486c8a66267f268427b01c1426ae7e2db3ba437958c827bc1d4220e6c443a6Wager136073602022-09-17 13:50:1619 days 16 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN 0xee38613ef276249fd1d817efb432916c883173130.023570380285557 AVAX0.00919329255 29.85
0xfbde9d5c14d9c1be7d23b04c8a9e67bf971017fa4b6e088858d5a4a3f7c5fa26Wager136073492022-09-17 13:49:5419 days 16 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN 0xee38613ef276249fd1d817efb432916c883173130.023570380285557 AVAX0.008007558 26
0x9b127d899840565217fc76a536a5f2bc5d994711bb1165d567797f8e64aa356cWager136073252022-09-17 13:48:4419 days 16 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN 0xee38613ef276249fd1d817efb432916c883173130.023570380285557 AVAX0.00262684375 31.25
0xa9c21da658130d2a54fc3dc514e6a1c7b8bd1aa9211a46772f22e17957795c0eWager136073112022-09-17 13:48:1219 days 16 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN 0xee38613ef276249fd1d817efb432916c883173130.023570380285557 AVAX0.00800787 26
0xac9efd3b5a0e7cad2cdb4da50690896358ab8316e682fc678fbfccca3fd8cdc5Wager136073042022-09-17 13:47:5019 days 16 hrs ago0x2c305888a456e7004663bc12a74395e637eabcbc IN 0xee38613ef276249fd1d817efb432916c883173130.023570380285557 AVAX0.00845247 26
0x4d33891c7101b5ed9a44b69688c156a84b4e60b2a3be38d464df3dec2662f757Wager133738482022-09-11 7:34:3425 days 22 hrs ago0x59772e95c77dd1575fb916dacdfabef688cc7971 IN 0xee38613ef276249fd1d817efb432916c883173130.028463059915471 AVAX0.0084695325 27.5
0x0c6a575cccf546f48dbd3a631986c37e937025c45827cd5cdbabc6db5e82a61eWager133738322022-09-11 7:33:5825 days 22 hrs ago0x59772e95c77dd1575fb916dacdfabef688cc7971 IN 0xee38613ef276249fd1d817efb432916c883173130.014963059915471 AVAX0.0084692025 27.5
0x48ddfe365d245f4c3f2e49cab4fc52446b9c44c83b66aac10913f7188960991bWager133738202022-09-11 7:33:2525 days 22 hrs ago0x59772e95c77dd1575fb916dacdfabef688cc7971 IN 0xee38613ef276249fd1d817efb432916c883173130.014963059915471 AVAX0.0084692025 27.5
0x6a7e073f3b12e859c5221b78f45d80a660abdcf2acbbe62a6f3c4efe2b196630Wager133738032022-09-11 7:32:4325 days 22 hrs ago0x59772e95c77dd1575fb916dacdfabef688cc7971 IN 0xee38613ef276249fd1d817efb432916c883173130.014963059915471 AVAX0.0084692025 27.5
0xaa23f18c0f73146f3b64dc5404cc76e36e312fc38576a9dc5731d85653fe19ffWager133737812022-09-11 7:31:4625 days 22 hrs ago0x59772e95c77dd1575fb916dacdfabef688cc7971 IN 0xee38613ef276249fd1d817efb432916c883173130.014963059915471 AVAX0.0084692025 27.5
0x3e394b61cffeb3bd1a2377515091bace7db662f715df9d6f80f73ccff1e9c3ddWager133737602022-09-11 7:30:5625 days 22 hrs ago0x59772e95c77dd1575fb916dacdfabef688cc7971 IN 0xee38613ef276249fd1d817efb432916c883173130.014963059915471 AVAX0.0084692025 27.5
0x807724235a17eed9f126298cc6728c379e2316e14cc611a61c41b60f5c368381Wager133737462022-09-11 7:30:2725 days 22 hrs ago0x59772e95c77dd1575fb916dacdfabef688cc7971 IN 0xee38613ef276249fd1d817efb432916c883173130.014963059915471 AVAX0.0084692025 27.5
0x38f1b7f817865f74e23c8f1bdf61fce1cb532c11c709fddfd9b4d4135a4d16a4Wager133737292022-09-11 7:29:3425 days 22 hrs ago0x59772e95c77dd1575fb916dacdfabef688cc7971 IN 0xee38613ef276249fd1d817efb432916c883173130.014963059915471 AVAX0.0084692025 27.5
0x3fcf6d0495f1f895e0e32919dc70cb59acbd12ea5c45b97d3d6a55a8d71c771dWager133737122022-09-11 7:28:2825 days 22 hrs ago0x59772e95c77dd1575fb916dacdfabef688cc7971 IN 0xee38613ef276249fd1d817efb432916c883173130.023363059915471 AVAX0.0084692025 27.5
0x10f5ffd5f06af79716e632a4b73213644e09a5315782e1cbe5e0d918bc37e49dWager133736932022-09-11 7:27:2125 days 22 hrs ago0x59772e95c77dd1575fb916dacdfabef688cc7971 IN 0xee38613ef276249fd1d817efb432916c883173130.014873059915471 AVAX0.0084695325 27.5
0x11f2ef1b18895b1d0eaa461b3aa717fb61d02daeb2a42a9e903899e012ff2a8fWager133736762022-09-11 7:26:2325 days 22 hrs ago0x59772e95c77dd1575fb916dacdfabef688cc7971 IN 0xee38613ef276249fd1d817efb432916c883173130.014873059915471 AVAX0.0084695325 27.5
0x57cd47c421510b2d26c40a952e35c930a9298a41c35af41c3d80b8134026a2a1Wager133736582022-09-11 7:25:1725 days 22 hrs ago0x59772e95c77dd1575fb916dacdfabef688cc7971 IN 0xee38613ef276249fd1d817efb432916c883173130.014873059915471 AVAX0.0084695325 27.5
0x6715936fd7f41ca6e0d8630b5f045818c962f546a6feefb93ad779bfa0f18b86Wager133736072022-09-11 7:22:3625 days 22 hrs ago0x59772e95c77dd1575fb916dacdfabef688cc7971 IN 0xee38613ef276249fd1d817efb432916c883173130.014873059915471 AVAX0.0084695325 27.5
0xbc02c4579ddcab999c670f6285934fbd8f4bd5b4163f6aee03f376dfaefa4a26Wager133735892022-09-11 7:21:4025 days 22 hrs ago0x59772e95c77dd1575fb916dacdfabef688cc7971 IN 0xee38613ef276249fd1d817efb432916c883173130.014873059915471 AVAX0.0084695325 27.5
0xc6cd3c32c05be7ef4da43f56a14f3bef915c9ae9d08cde2f4c29474d920bf96cWager133735792022-09-11 7:21:0825 days 22 hrs ago0x59772e95c77dd1575fb916dacdfabef688cc7971 IN 0xee38613ef276249fd1d817efb432916c883173130.014873059915471 AVAX0.0084695325 27.5
0x6621ad7b19aaaed5f3701455297fb40cb7b9ba5d4caeb4f767cc07cd8bab3020Wager133735682022-09-11 7:20:3425 days 22 hrs ago0x59772e95c77dd1575fb916dacdfabef688cc7971 IN 0xee38613ef276249fd1d817efb432916c883173130.014883526147015 AVAX0.0084695325 27.5
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0xc84f696f04b5f74cfdc36fa2d9fe401558b56eac10ab6028ecb385f0ea018168143027262022-10-05 3:08:032 days 3 hrs ago 0xee38613ef276249fd1d817efb432916c883173130x2671ceccc4de126d45bac0b66142e35304411a9e0 AVAX
0xc84f696f04b5f74cfdc36fa2d9fe401558b56eac10ab6028ecb385f0ea018168143027262022-10-05 3:08:032 days 3 hrs ago 0xee38613ef276249fd1d817efb432916c883173130x2ed832ba664535e5886b75d64c46eb9a228c26100 AVAX
0xc84f696f04b5f74cfdc36fa2d9fe401558b56eac10ab6028ecb385f0ea018168143027262022-10-05 3:08:032 days 3 hrs ago 0xee38613ef276249fd1d817efb432916c883173130x35fd0516074d4735fea7ee7edc69176b2cfcb42a0 AVAX
0xc84f696f04b5f74cfdc36fa2d9fe401558b56eac10ab6028ecb385f0ea018168143027262022-10-05 3:08:032 days 3 hrs ago 0xee38613ef276249fd1d817efb432916c883173130x35fd0516074d4735fea7ee7edc69176b2cfcb42a0 AVAX
0xc84f696f04b5f74cfdc36fa2d9fe401558b56eac10ab6028ecb385f0ea018168143027262022-10-05 3:08:032 days 3 hrs ago 0xee38613ef276249fd1d817efb432916c883173130x35fd0516074d4735fea7ee7edc69176b2cfcb42a0 AVAX
0xc84f696f04b5f74cfdc36fa2d9fe401558b56eac10ab6028ecb385f0ea018168143027262022-10-05 3:08:032 days 3 hrs ago 0xee38613ef276249fd1d817efb432916c883173130x2ed832ba664535e5886b75d64c46eb9a228c26100 AVAX
0xc84f696f04b5f74cfdc36fa2d9fe401558b56eac10ab6028ecb385f0ea018168143027262022-10-05 3:08:032 days 3 hrs ago 0xee38613ef276249fd1d817efb432916c883173130x79c91fd4f8b3dabee17d286eb11cee4d835217750 AVAX
0xc84f696f04b5f74cfdc36fa2d9fe401558b56eac10ab6028ecb385f0ea018168143027262022-10-05 3:08:032 days 3 hrs ago 0xee38613ef276249fd1d817efb432916c883173130x35fd0516074d4735fea7ee7edc69176b2cfcb42a0 AVAX
0x8d9325c4b4fec6bb452bb7828b2d174eaea5ecc0eaa8a3679bdfee8f3162bc46136074122022-09-17 13:52:2919 days 16 hrs ago 0xee38613ef276249fd1d817efb432916c883173130x35fd0516074d4735fea7ee7edc69176b2cfcb42a0.01 AVAX
0x8d9325c4b4fec6bb452bb7828b2d174eaea5ecc0eaa8a3679bdfee8f3162bc46136074122022-09-17 13:52:2919 days 16 hrs ago 0x2ed832ba664535e5886b75d64c46eb9a228c26100xee38613ef276249fd1d817efb432916c883173130 AVAX
0x4f65c069d6f603d6b95187c25b2819264698e08374f6cb59da1637779eb97207136074072022-09-17 13:52:1919 days 16 hrs ago 0xee38613ef276249fd1d817efb432916c883173130x2ed832ba664535e5886b75d64c46eb9a228c26100 AVAX
0x4f65c069d6f603d6b95187c25b2819264698e08374f6cb59da1637779eb97207136074072022-09-17 13:52:1919 days 16 hrs ago 0xee38613ef276249fd1d817efb432916c883173130x35fd0516074d4735fea7ee7edc69176b2cfcb42a0 AVAX
0x4f65c069d6f603d6b95187c25b2819264698e08374f6cb59da1637779eb97207136074072022-09-17 13:52:1919 days 16 hrs ago 0xee38613ef276249fd1d817efb432916c883173130x35fd0516074d4735fea7ee7edc69176b2cfcb42a0 AVAX
0x4f65c069d6f603d6b95187c25b2819264698e08374f6cb59da1637779eb97207136074072022-09-17 13:52:1919 days 16 hrs ago 0xee38613ef276249fd1d817efb432916c883173130x35fd0516074d4735fea7ee7edc69176b2cfcb42a0 AVAX
0x4f65c069d6f603d6b95187c25b2819264698e08374f6cb59da1637779eb97207136074072022-09-17 13:52:1919 days 16 hrs ago 0xee38613ef276249fd1d817efb432916c883173130x2ed832ba664535e5886b75d64c46eb9a228c26100 AVAX
0x4f65c069d6f603d6b95187c25b2819264698e08374f6cb59da1637779eb97207136074072022-09-17 13:52:1919 days 16 hrs ago 0xee38613ef276249fd1d817efb432916c883173130x79c91fd4f8b3dabee17d286eb11cee4d835217750 AVAX
0x4f65c069d6f603d6b95187c25b2819264698e08374f6cb59da1637779eb97207136074072022-09-17 13:52:1919 days 16 hrs ago 0xee38613ef276249fd1d817efb432916c883173130x35fd0516074d4735fea7ee7edc69176b2cfcb42a0 AVAX
0xda09ced2ce0fed58c21ccb0f35400fd7214208d34cfe4e90c7cae0dac04105ee136073972022-09-17 13:51:5919 days 16 hrs ago 0xee38613ef276249fd1d817efb432916c883173130x35fd0516074d4735fea7ee7edc69176b2cfcb42a0.01 AVAX
0xda09ced2ce0fed58c21ccb0f35400fd7214208d34cfe4e90c7cae0dac04105ee136073972022-09-17 13:51:5919 days 16 hrs ago 0x2ed832ba664535e5886b75d64c46eb9a228c26100xee38613ef276249fd1d817efb432916c883173130 AVAX
0xc88eac53421eedc28932f1a56a963ed514e45aed6f6dd78a55c79cba1243c7fd136073942022-09-17 13:51:5119 days 16 hrs ago 0xee38613ef276249fd1d817efb432916c883173130x2ed832ba664535e5886b75d64c46eb9a228c26100 AVAX
0xc88eac53421eedc28932f1a56a963ed514e45aed6f6dd78a55c79cba1243c7fd136073942022-09-17 13:51:5119 days 16 hrs ago 0xee38613ef276249fd1d817efb432916c883173130x35fd0516074d4735fea7ee7edc69176b2cfcb42a0 AVAX
0xc88eac53421eedc28932f1a56a963ed514e45aed6f6dd78a55c79cba1243c7fd136073942022-09-17 13:51:5119 days 16 hrs ago 0xee38613ef276249fd1d817efb432916c883173130x35fd0516074d4735fea7ee7edc69176b2cfcb42a0 AVAX
0xc88eac53421eedc28932f1a56a963ed514e45aed6f6dd78a55c79cba1243c7fd136073942022-09-17 13:51:5119 days 16 hrs ago 0xee38613ef276249fd1d817efb432916c883173130x35fd0516074d4735fea7ee7edc69176b2cfcb42a0 AVAX
0xc88eac53421eedc28932f1a56a963ed514e45aed6f6dd78a55c79cba1243c7fd136073942022-09-17 13:51:5119 days 16 hrs ago 0xee38613ef276249fd1d817efb432916c883173130x2ed832ba664535e5886b75d64c46eb9a228c26100 AVAX
0xc88eac53421eedc28932f1a56a963ed514e45aed6f6dd78a55c79cba1243c7fd136073942022-09-17 13:51:5119 days 16 hrs ago 0xee38613ef276249fd1d817efb432916c883173130x79c91fd4f8b3dabee17d286eb11cee4d835217750 AVAX
[ 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:
Roulette

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 : 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);
    }
}

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

pragma solidity 0.8.16;

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

/// @title BetSwirl's Roulette game
/// @notice
/// @author Romuald Hog
contract Roulette is Game {
    /// @notice Full roulette bet information struct.
    /// @param bet The Bet struct information.
    /// @param rouletteBet The Roulette bet struct information.
    /// @dev Used to package bet information for the front-end.
    struct FullRouletteBet {
        Bet bet;
        RouletteBet rouletteBet;
    }

    /// @notice Roulette bet information struct.
    /// @param bet The Bet struct information.
    /// @param numbers The chosen numbers.
    struct RouletteBet {
        uint40 numbers;
        uint8 rolled;
    }

    uint8 private constant MODULO = 37;
    uint256 private constant POPCNT_MULT =
        0x0000000000002000000000100000000008000000000400000000020000000001;
    uint256 private constant POPCNT_MASK =
        0x0001041041041041041041041041041041041041041041041041041041041041;
    uint256 private constant POPCNT_MODULO = 0x3F;

    /// @notice Maps bets IDs to chosen numbers.
    mapping(uint256 => RouletteBet) public rouletteBets;

    /// @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 numbers The chosen numbers.
    event PlaceBet(
        uint256 id,
        address indexed user,
        address indexed token,
        uint256 amount,
        uint256 vrfCost,
        uint40 numbers
    );

    /// @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 numbers The chosen numbers.
    /// @param rolled The rolled number.
    /// @param payout The payout amount.
    event Roll(
        uint256 id,
        address indexed user,
        address indexed token,
        uint256 amount,
        uint40 numbers,
        uint8 rolled,
        uint256 payout
    );

    /// @notice Provided cap is under the minimum.
    error NumbersNotInRange();

    /// @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 numbers The chosen numbers.
    /// @return The target payout amount.
    function _getPayout(uint256 betAmount, uint40 numbers)
        private
        pure
        returns (uint256)
    {
        return
            (betAmount * MODULO) /
            (((numbers * POPCNT_MULT) & POPCNT_MASK) % POPCNT_MODULO);
    }

    /// @notice Creates a new bet and stores the chosen bet mask.
    /// @param numbers The chosen numbers.
    /// @param token Address of the token.
    /// @param tokenAmount The number of tokens bet.
    function wager(
        uint40 numbers,
        address token,
        uint256 tokenAmount
    ) external payable whenNotPaused {
        if (numbers == 0 || numbers >= 2**MODULO - 1) {
            revert NumbersNotInRange();
        }

        Bet memory bet = _newBet(
            token,
            tokenAmount,
            _getPayout(10000, numbers)
        );

        rouletteBets[bet.id].numbers = numbers;

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

    /// @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
    {
        RouletteBet storage rouletteBet = rouletteBets[id];
        Bet storage bet = bets[id];

        uint8 rolled = uint8(randomWords[0] % MODULO);
        rouletteBet.rolled = rolled;
        uint256 payout = _resolveBet(
            bet,
            (2**rolled) & rouletteBet.numbers != 0,
            _getPayout(bet.amount, rouletteBet.numbers)
        );

        emit Roll(
            bet.id,
            bet.user,
            bet.token,
            bet.amount,
            rouletteBet.numbers,
            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 (FullRouletteBet[] memory)
    {
        Bet[] memory lastBets = _getLastUserBets(user, dataLength);
        FullRouletteBet[] memory lastRouletteBets = new FullRouletteBet[](
            lastBets.length
        );
        for (uint256 i; i < lastBets.length; i++) {
            lastRouletteBets[i] = FullRouletteBet(
                lastBets[i],
                rouletteBets[lastBets[i].id]
            );
        }
        return lastRouletteBets;
    }
}

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":[],"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":[],"name":"NumbersNotInRange","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":"uint40","name":"numbers","type":"uint40"}],"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":"uint40","name":"numbers","type":"uint40"},{"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":[],"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":"uint40","name":"numbers","type":"uint40"},{"internalType":"uint8","name":"rolled","type":"uint8"}],"internalType":"struct Roulette.RouletteBet","name":"rouletteBet","type":"tuple"}],"internalType":"struct Roulette.FullRouletteBet[]","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":"uint256","name":"","type":"uint256"}],"name":"rouletteBets","outputs":[{"internalType":"uint40","name":"numbers","type":"uint40"},{"internalType":"uint8","name":"rolled","type":"uint8"}],"stateMutability":"view","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":"uint40","name":"numbers","type":"uint40"},{"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"}]

60c06040523480156200001157600080fd5b50604051620036eb380380620036eb8339810160408190526200003491620002ad565b82826001838262000045336200015c565b6000805460ff60a01b191690556001600160a01b0390811660805260018055811615806200007a57506001600160a01b038316155b15620000995760405163e6c4247b60e01b815260040160405180910390fd5b61ffff821615801590620000b357506101f48261ffff1611155b620001055760405162461bcd60e51b815260206004820152601e60248201527f57726f6e6720436861696e6c696e6b204e756d52616e646f6d576f726473000060448201526064015b60405180910390fd5b6200011084620001ac565b600480546001600160a01b039485166001600160a01b03199091161790556002805461ffff909316620100000263ffff000019909316929092179091551660a05250620002f792505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b620001b662000232565b6001600160a01b038116620001de5760405163e6c4247b60e01b815260040160405180910390fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f10f5824683d64a0712038f2244e046b174a1cc57fbb8556bfda5ffb2612440679060200160405180910390a150565b6000546001600160a01b031633146200028e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401620000fc565b565b80516001600160a01b0381168114620002a857600080fd5b919050565b600080600060608486031215620002c357600080fd5b620002ce8462000290565b9250620002de6020850162000290565b9150620002ee6040850162000290565b90509250925092565b60805160a0516133c7620003246000396000610b670152600081816106d5015261073001526133c76000f3fe6080604052600436106101755760003560e01c80638456cb59116100cb578063be27e5301161007f578063e32fe50411610059578063e32fe5041461053c578063e48603391461055c578063f2fde38b146105f657600080fd5b8063be27e5301461048e578063c2fb579f146104ef578063e1fdb4b41461051c57600080fd5b8063982c3fdd116100b0578063982c3fdd14610413578063a23cd7df14610441578063ac9650d81461046157600080fd5b80638456cb59146103e05780638da5cb5b146103f557600080fd5b80635c975abb1161012d57806376cdb03b1161010757806376cdb03b1461034957806378bcde22146103815780637d0807d7146103a157600080fd5b80635c975abb146102e4578063707cd55e14610314578063715018a61461033457600080fd5b806322af00fa1161015e57806322af00fa146101bc578063594043fd146102795780635c592e72146102d157600080fd5b8063090d23b91461017a5780631fe543e31461019c575b600080fd5b34801561018657600080fd5b5061019a6101953660046129fe565b610616565b005b3480156101a857600080fd5b5061019a6101b7366004612a4a565b6106ca565b3480156101c857600080fd5b5061022b6101d7366004612b32565b6005602081905260009182526040909120805460018201546002830154600384015460048501549585015460069095015460ff8516966101009095046001600160a01b039081169694169492939192919088565b6040805198151589526001600160a01b0397881660208a015295909616948701949094526060860192909252608085015260a084015260c083015260e0820152610100015b60405180910390f35b34801561028557600080fd5b506102c16102943660046129fe565b6001600160a01b031660009081526007602052604090205462010000900467ffffffffffffffff16151590565b6040519015158152602001610270565b61019a6102df366004612b4b565b610770565b3480156102f057600080fd5b5060005474010000000000000000000000000000000000000000900460ff166102c1565b34801561032057600080fd5b5061019a61032f3660046129fe565b6108b2565b34801561034057600080fd5b5061019a6109f3565b34801561035557600080fd5b50600854610369906001600160a01b031681565b6040516001600160a01b039091168152602001610270565b34801561038d57600080fd5b5061019a61039c366004612bad565b610a07565b3480156103ad57600080fd5b506002546003546004546040805161ffff909416845260208401929092526001600160a01b031690820152606001610270565b3480156103ec57600080fd5b5061019a610b27565b34801561040157600080fd5b506000546001600160a01b0316610369565b34801561041f57600080fd5b5061043361042e3660046129fe565b610b62565b604051908152602001610270565b34801561044d57600080fd5b5061019a61045c366004612be2565b610d4e565b34801561046d57600080fd5b5061048161047c366004612c0c565b610dc9565b6040516102709190612cef565b34801561049a57600080fd5b506104d06104a9366004612b32565b60096020526000908152604090205464ffffffffff81169065010000000000900460ff1682565b6040805164ffffffffff909316835260ff909116602083015201610270565b3480156104fb57600080fd5b5061050f61050a366004612d6f565b610ebf565b6040516102709190612d8d565b34801561052857600080fd5b5061019a610537366004612b32565b611051565b34801561054857600080fd5b5061019a610557366004612e5b565b611368565b34801561056857600080fd5b506105bd6105773660046129fe565b6007602052600090815260409020805460019091015461ffff82169162010000810467ffffffffffffffff16916a010000000000000000000090910463ffffffff169084565b6040805161ffff909516855267ffffffffffffffff909316602085015263ffffffff909116918301919091526060820152608001610270565b34801561060257600080fd5b5061019a6106113660046129fe565b6113fa565b61061e61148a565b6001600160a01b03811661065e576040517fe6c4247b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600880547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0383169081179091556040519081527f10f5824683d64a0712038f2244e046b174a1cc57fbb8556bfda5ffb2612440679060200160405180910390a150565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610762576040517f1cf993f40000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001660248201526044015b60405180910390fd5b61076c82826114e4565b5050565b61077861162d565b64ffffffffff831615806107aa5750600161079560256002612fa7565b61079f9190612fb6565b8364ffffffffff1610155b156107e1576040517f9f7d67a400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006107f983836107f461271088611698565b61170e565b6060818101805160009081526009602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000001664ffffffffff8b169081179091558286015182870151945160808089015160e08a015187519384529583015294810193909352948201529394506001600160a01b039283169392909116917fc68a28552c2af0dc893d789f7458205e8879657e306b928a0e93340fddc5ec1a910160405180910390a350505050565b6001600160a01b038116600090815260076020526040902060010154801561076c576001600160a01b038281166000818152600760205260408082206001019190915560085490517fdc17c9ca00000000000000000000000000000000000000000000000000000000815260048101929092529091169063dc17c9ca90602401602060405180830381865afa15801561094f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109739190612fc9565b6001600160a01b03166108fc829081150290604051600060405180830381858888f193505050501580156109ab573d6000803e3d6000fd5b50816001600160a01b03167f1d3f9fc0810d9e182e982399cb91de735f6c415728fb9bc42664b84087c2af56826040516109e791815260200190565b60405180910390a25050565b6109fb61148a565b610a056000611e52565b565b610a0f61148a565b6101908161ffff161115610a4f576040517f70b5774c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03821660009081526007602052604090205462010000900467ffffffffffffffff1615610aaf576040517faa4256e000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03821660008181526007602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001661ffff861690811790915591519182527f7dfd3ecb8ac83242184c019f85ca408558f2ac0a5a19af6be2a4aee697eac81291016109e7565b610b2f61148a565b60005474010000000000000000000000000000000000000000900460ff1615610b5a57610a05611eba565b610a05611f2a565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015610bc3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610be79190613000565b50505091505060008113610c2a576040517f43d4cf6600000000000000000000000000000000000000000000000000000000815260048101829052602401610759565b60048054604080517f5fbbc0d200000000000000000000000000000000000000000000000000000000815290516000936001600160a01b0390931692635fbbc0d292808201926101209290918290030181865afa158015610c8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cb39190613063565b50505050505050509050670de0b6b3a7640000828263ffffffff1664e8d4a51000610cde9190613119565b610ce89190613119565b610cf29190613167565b6001600160a01b038516600090815260076020526040902054610d2c906a0100000000000000000000900463ffffffff166201c13861317b565b610d3c9063ffffffff163a613119565b610d469190613198565b949350505050565b610d5661148a565b600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001661ffff8416908117909155600382905560408051918252602082018390527f312eab8f28128692f3404f828c413db540bc15a246c46d0b40e3c004b947c437910160405180910390a15050565b60608167ffffffffffffffff811115610de457610de4612a1b565b604051908082528060200260200182016040528015610e1757816020015b6060815260200190600190039081610e025790505b50905060005b82811015610eb757610e8730858584818110610e3b57610e3b6131ab565b9050602002810190610e4d91906131da565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611f9992505050565b828281518110610e9957610e996131ab565b60200260200101819052508080610eaf90613246565b915050610e1d565b505b92915050565b60606000610ecd8484611fbe565b90506000815167ffffffffffffffff811115610eeb57610eeb612a1b565b604051908082528060200260200182016040528015610f7e57816020015b60408051610140810182526000818301818152606083018290526080830182905260a0830182905260c0830182905260e083018290526101008301829052610120830182905282528251808401909352808352602080840191909152810191909152815260200190600190039081610f095790505b50905060005b8251811015611048576040518060400160405280848381518110610faa57610faa6131ab565b6020026020010151815260200160096000868581518110610fcd57610fcd6131ab565b60209081029190910181015160600151825281810192909252604090810160002081518083019092525464ffffffffff8116825265010000000000900460ff16918101919091529052825183908390811061102a5761102a6131ab565b6020026020010181905250808061104090613246565b915050610f84565b50949350505050565b6002600154036110a35760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610759565b6002600190815560008281526005602052604090208054909160ff909116151590036110fb576040517f21abe57a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600481015461110b90601e613198565b431015611144576040517f07bc6c3e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60018101546001600160a01b03166000908152600760205260409020805462010000900467ffffffffffffffff1681600261117e83613260565b825467ffffffffffffffff9182166101009390930a92830291909202199091161790555081547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660019081178355600383015460058401558201546001600160a01b031661122e57815460038301546040516101009092046001600160a01b0316916108fc82150291906000818181858888f19350505050158015611228573d6000803e3d6000fd5b50611259565b815460038301546001840154611259926001600160a01b0391821692610100909104909116906121e9565b6006820154600182015481118015906112725750804710155b1561132c578082600101600082825461128b9190612fb6565b909155505082546040516101009091046001600160a01b0316906108fc8315029083906000818181858888f193505050501580156112cd573d6000803e3d6000fd5b5082546003840154604080518781526101009093046001600160a01b03166020840152820152606081018290527fe282fd838bb937af0c0f54e49ba5f86229ed0c90344c3cc4e2135cb673493e699060800160405180910390a161135e565b6040517fb0ee34b600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050600180555050565b61137061148a565b6001600160a01b03821660008181526007602090815260409182902080547fffffffffffffffffffffffffffffffffffff00000000ffffffffffffffffffff166a010000000000000000000063ffffffff87169081029190911790915591519182527f9edb52532d26512950c91a14b132f6df3cd06bfb49e795e03e56736121cd24a891016109e7565b61140261148a565b6001600160a01b03811661147e5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610759565b61148781611e52565b50565b6000546001600160a01b03163314610a055760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610759565b60008281526009602090815260408083206005909252822083519192909160259085908390611515576115156131ab565b60200260200101516115279190613284565b835460ff821665010000000000027fffffffffffffffffffffffffffffffffffffffffffffffffffff00ffffffffff8216811786559192506000916115a291859164ffffffffff90811691161761157f856002612fa7565b600387015488549190921615159161159d9164ffffffffff16611698565b6122b5565b6001840154845460028601546003870154885460408051938452602084019290925264ffffffffff169082015260ff86166060820152608081018490529293506001600160a01b0391821692610100909104909116907f31f298f8512cd20a0c9f7631142286da4f52772d89b405b5c68274c4c64cb4339060a00160405180910390a3505050505050565b60005474010000000000000000000000000000000000000000900460ff1615610a055760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610759565b6000603f7e010410410410410410410410410410410410410410410410410410410410416116e779200000000010000000000800000000040000000002000000000164ffffffffff8616613119565b166116f29190613284565b6116fd602585613119565b6117079190613167565b9392505050565b61176a60405180610100016040528060001515815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160008152602001600081526020016000815260200160008152602001600081525090565b61177261162d565b6002600154036117c45760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610759565b60026001556001600160a01b038481166000818152600760205260409081902060085491517fcbe230c3000000000000000000000000000000000000000000000000000000008152600481019390935292169063cbe230c390602401602060405180830381865afa15801561183d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118619190613298565b15806118705750805461ffff16155b156118a7576040517fc455905500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336001600160a01b038616156000816118c057346118ca565b6118ca8734612fb6565b90506000826118d957876118e3565b6118e38234612fb6565b905060006118f08a610b62565b905060646118ff82600a613119565b6119099190613167565b6119139082612fb6565b83101561194c576040517f0b56cefe00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b828660010160008282546119609190613198565b90915550506008546040517ff6b2a2f10000000000000000000000000000000000000000000000000000000081526001600160a01b038c81166004830152600093509091169063f6b2a2f190602401602060405180830381865afa1580156119cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119f091906132ba565b905080821015611a2f576040517f022558f400000000000000000000000000000000000000000000000000000000815260048101829052602401610759565b6008546040517f278b39de0000000000000000000000000000000000000000000000000000000081526001600160a01b038c81166004830152602482018b9052600092169063278b39de90604401602060405180830381865afa158015611a9a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611abe91906132ba565b905080831115611b13578415611b0f576001600160a01b0386166108fc611ae58386612fb6565b6040518115909202916000818181858888f19350505050158015611b0d573d6000803e3d6000fd5b505b8092505b5050600480546003546008546040517f279e34150000000000000000000000000000000000000000000000000000000081526001600160a01b038e81169582019590955260009493841693635d3b1d309392169063279e341590602401602060405180830381865afa158015611b8d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bb191906132d3565b6002548a5460405160e086901b7fffffffff00000000000000000000000000000000000000000000000000000000168152600481019490945267ffffffffffffffff909216602484015261ffff80821660448501526a010000000000000000000090920463ffffffff16606484015262010000900416608482015260a4016020604051808303816000875af1158015611c4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c7291906132ba565b90506000604051806101000160405280600015158152602001876001600160a01b031681526020018c6001600160a01b031681526020018381526020018481526020014381526020016000815260200185815250905060066000876001600160a01b03166001600160a01b03168152602001908152602001600020829080600181540180825580915050600190039060005260206000200160009091909190915055806005600084815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160010160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550606082015181600201556080820151816003015560a0820151816004015560c0820151816005015560e0820151816006015590505086600001600281819054906101000a900467ffffffffffffffff1680929190611dff906132fd565b91906101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055505084611e4057611e406001600160a01b038c1687308661260f565b600180559a9950505050505050505050565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b611ec2612666565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b611f3261162d565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611f0d3390565b6060611707838360405180606001604052806027815260200161336b602791396126d0565b6001600160a01b038216600090815260066020908152604080832080548251818502810185019093528083526060949383018282801561201d57602002820191906000526020600020905b815481526020019060010190808311612009575b5050835193945050505083811015612033578093505b60008467ffffffffffffffff81111561204e5761204e612a1b565b6040519080825280602002602001820160405280156120db57816020015b6120c860405180610100016040528060001515815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160008152602001600081526020016000815260200160008152602001600081525090565b81526020019060019003908161206c5790505b50905084156121e0576000825b6120f28785612fb6565b8111156121dd576005600086612109600185612fb6565b81518110612119576121196131ab565b602090810291909101810151825281810192909252604090810160002081516101008082018452825460ff811615158352046001600160a01b03908116948201949094526001820154909316918301919091526002810154606083015260038101546080830152600481015460a0830152600581015460c08301526006015460e082015283518490849081106121b1576121b16131ab565b602002602001018190525081806121c790613246565b92505080806121d590613324565b9150506120e8565b50505b95945050505050565b6040516001600160a01b0383166024820152604481018290526122b09084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526127c4565b505050565b825460009060ff161515600114806122da5750835461010090046001600160a01b0316155b15612311576040517f21abe57a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b83547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811785558401546001600160a01b03166000818152600760205260409020805467ffffffffffffffff620100009091041690600261237583613260565b825467ffffffffffffffff9182166101009390930a928302919092021990911617905550600385015460018601546001600160a01b031615851561254457865461010090046001600160a01b031660006123cf8488612fb6565b905060006123dd86866128a9565b905060006123eb87846128a9565b905060006123f98284613198565b9050612405818b612fb6565b995060006124138489612fb6565b905060006124218487612fb6565b90508715612465576040516001600160a01b0388169083156108fc029084906000818181858888f1935050505015801561245f573d6000803e3d6000fd5b50612493565b6124796001600160a01b038b1688846121e9565b600854612493906001600160a01b038c81169116876121e9565b6008546001600160a01b0316631f615023896124b05760006124b2565b865b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526001600160a01b03808c1660048301528e16602482015260448101859052606481018790526084016000604051808303818588803b15801561251f57600080fd5b505af1158015612533573d6000803e3d6000fd5b5050505050505050505050506125fe565b600094508061256757600854612567906001600160a01b038581169116846121e9565b6008546001600160a01b0316633138809d82612584576000612586565b835b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526001600160a01b0387166004820152602481018690526044016000604051808303818588803b1580156125e457600080fd5b505af11580156125f8573d6000803e3d6000fd5b50505050505b505050506005929092018290555090565b6040516001600160a01b03808516602483015283166044820152606481018290526126609085907f23b872dd000000000000000000000000000000000000000000000000000000009060840161222e565b50505050565b60005474010000000000000000000000000000000000000000900460ff16610a055760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610759565b60606001600160a01b0384163b61274f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e747261637400000000000000000000000000000000000000000000000000006064820152608401610759565b600080856001600160a01b03168560405161276a919061333b565b600060405180830381855af49150503d80600081146127a5576040519150601f19603f3d011682016040523d82523d6000602084013e6127aa565b606091505b50915091506127ba8282866128d5565b9695505050505050565b6000612819826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661290e9092919063ffffffff16565b8051909150156122b057808060200190518101906128379190613298565b6122b05760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610759565b6001600160a01b038216600090815260076020526040812054612710906116fd90849061ffff16613119565b606083156128e4575081611707565b8251156128f45782518084602001fd5b8160405162461bcd60e51b81526004016107599190613357565b6060610d468484600085856001600160a01b0385163b6129705760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610759565b600080866001600160a01b0316858760405161298c919061333b565b60006040518083038185875af1925050503d80600081146129c9576040519150601f19603f3d011682016040523d82523d6000602084013e6129ce565b606091505b50915091506129de8282866128d5565b979650505050505050565b6001600160a01b038116811461148757600080fd5b600060208284031215612a1057600080fd5b8135611707816129e9565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008060408385031215612a5d57600080fd5b8235915060208084013567ffffffffffffffff80821115612a7d57600080fd5b818601915086601f830112612a9157600080fd5b813581811115612aa357612aa3612a1b565b8060051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f83011681018181108582111715612ae657612ae6612a1b565b604052918252848201925083810185019189831115612b0457600080fd5b938501935b82851015612b2257843584529385019392850192612b09565b8096505050505050509250929050565b600060208284031215612b4457600080fd5b5035919050565b600080600060608486031215612b6057600080fd5b833564ffffffffff81168114612b7557600080fd5b92506020840135612b85816129e9565b929592945050506040919091013590565b803561ffff81168114612ba857600080fd5b919050565b60008060408385031215612bc057600080fd5b8235612bcb816129e9565b9150612bd960208401612b96565b90509250929050565b60008060408385031215612bf557600080fd5b612bfe83612b96565b946020939093013593505050565b60008060208385031215612c1f57600080fd5b823567ffffffffffffffff80821115612c3757600080fd5b818501915085601f830112612c4b57600080fd5b813581811115612c5a57600080fd5b8660208260051b8501011115612c6f57600080fd5b60209290920196919550909350505050565b60005b83811015612c9c578181015183820152602001612c84565b50506000910152565b60008151808452612cbd816020860160208601612c81565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015612d62577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0888603018452612d50858351612ca5565b94509285019290850190600101612d16565b5092979650505050505050565b60008060408385031215612d8257600080fd5b8235612bfe816129e9565b602080825282518282018190526000919060409081850190868401855b82811015612e3c5781518051805115158652878101516001600160a01b0390811689880152878201511687870152606080820151908701526080808201519087015260a0808201519087015260c0808201519087015260e09081015190860152860151805164ffffffffff166101008601526020015160ff166101208501526101409093019290850190600101612daa565b5091979650505050505050565b63ffffffff8116811461148757600080fd5b60008060408385031215612e6e57600080fd5b8235612e79816129e9565b91506020830135612e8981612e49565b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600181815b80851115612efe578160001904821115612ee457612ee4612e94565b80851615612ef157918102915b93841c9390800290612ec8565b509250929050565b600082612f1557506001610eb9565b81612f2257506000610eb9565b8160018114612f385760028114612f4257612f5e565b6001915050610eb9565b60ff841115612f5357612f53612e94565b50506001821b610eb9565b5060208310610133831016604e8410600b8410161715612f81575081810a610eb9565b612f8b8383612ec3565b8060001904821115612f9f57612f9f612e94565b029392505050565b600061170760ff841683612f06565b81810381811115610eb957610eb9612e94565b600060208284031215612fdb57600080fd5b8151611707816129e9565b805169ffffffffffffffffffff81168114612ba857600080fd5b600080600080600060a0868803121561301857600080fd5b61302186612fe6565b945060208601519350604086015192506060860151915061304460808701612fe6565b90509295509295909350565b805162ffffff81168114612ba857600080fd5b60008060008060008060008060006101208a8c03121561308257600080fd5b895161308d81612e49565b60208b015190995061309e81612e49565b60408b01519098506130af81612e49565b60608b01519097506130c081612e49565b60808b01519096506130d181612e49565b94506130df60a08b01613050565b93506130ed60c08b01613050565b92506130fb60e08b01613050565b915061310a6101008b01613050565b90509295985092959850929598565b600081600019048311821515161561313357613133612e94565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60008261317657613176613138565b500490565b63ffffffff818116838216019080821115610eb757610eb7612e94565b80820180821115610eb957610eb9612e94565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261320f57600080fd5b83018035915067ffffffffffffffff82111561322a57600080fd5b60200191503681900382131561323f57600080fd5b9250929050565b6000600019820361325957613259612e94565b5060010190565b600067ffffffffffffffff82168061327a5761327a612e94565b6000190192915050565b60008261329357613293613138565b500690565b6000602082840312156132aa57600080fd5b8151801515811461170757600080fd5b6000602082840312156132cc57600080fd5b5051919050565b6000602082840312156132e557600080fd5b815167ffffffffffffffff8116811461170757600080fd5b600067ffffffffffffffff80831681810361331a5761331a612e94565b6001019392505050565b60008161333357613333612e94565b506000190190565b6000825161334d818460208701612c81565b9190910192915050565b6020815260006117076020830184612ca556fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122058a327b0f4c3862a79f61bf050948e2bffee64dc5b245b91573b7b01c4e00a5e64736f6c6343000810003300000000000000000000000035fd0516074d4735fea7ee7edc69176b2cfcb42a0000000000000000000000002ed832ba664535e5886b75d64c46eb9a228c261000000000000000000000000079c91fd4f8b3dabee17d286eb11cee4d83521775

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

00000000000000000000000035fd0516074d4735fea7ee7edc69176b2cfcb42a0000000000000000000000002ed832ba664535e5886b75d64c46eb9a228c261000000000000000000000000079c91fd4f8b3dabee17d286eb11cee4d83521775

-----Decoded View---------------
Arg [0] : bankAddress (address): 0x35fd0516074d4735fea7ee7edc69176b2cfcb42a
Arg [1] : chainlinkCoordinatorAddress (address): 0x2ed832ba664535e5886b75d64c46eb9a228c2610
Arg [2] : LINK_ETH_feedAddress (address): 0x79c91fd4f8b3dabee17d286eb11cee4d83521775

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 00000000000000000000000035fd0516074d4735fea7ee7edc69176b2cfcb42a
Arg [1] : 0000000000000000000000002ed832ba664535e5886b75d64c46eb9a228c2610
Arg [2] : 00000000000000000000000079c91fd4f8b3dabee17d286eb11cee4d83521775


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