Contract 0xea82821f75d3cb02c2b450eb43ae528603ea614a 1

Txn Hash Method
Block
From
To
Value [Txn Fee]
0xbb39685094075c287fa5aed3d2391b2e92603776cb17225fb18d7c67d08ce753Enter Raffle256835382023-02-01 7:01:5314 mins ago0x7e9639b6816b3b2622528bca7c21764ad10ecb4e IN  0xea82821f75d3cb02c2b450eb43ae528603ea614a0.69 AVAX0.00166478 26
0x7e145a530a7e2cd5c0592cc70c4a0cc3d249df04a05d3eb687feb0efb49b452cEnter Raffle256832522023-02-01 6:52:3723 mins ago0xfdd61c9d6f3bb9a910e1f825ee428a337a1b4662 IN  0xea82821f75d3cb02c2b450eb43ae528603ea614a5.52 AVAX0.001696795 26.5
0xaae2378bea87d134479f62cffb6637c8e98a4ddd727f4b1acda44f525b1795d2Enter Raffle256828772023-02-01 6:40:1635 mins ago0xc2fafbe87eb6ab93a944152abdf1827bfd3e8d39 IN  0xea82821f75d3cb02c2b450eb43ae528603ea614a0.05 AVAX0.001696795 26.5
0xad0bcd6343d64fa9649c6b0a24c139cab61e53c2bacd4dea34ed6b615799863cEnter Raffle256828522023-02-01 6:39:2636 mins ago0xc2fafbe87eb6ab93a944152abdf1827bfd3e8d39 IN  0xea82821f75d3cb02c2b450eb43ae528603ea614a0.22 AVAX0.001696795 26.5
0x3982853cf6bc666ad0f6eaa20e11be109e7a6c33f0cf52d3bb786f049d2be45aEnter Raffle256828312023-02-01 6:38:4437 mins ago0xc2fafbe87eb6ab93a944152abdf1827bfd3e8d39 IN  0xea82821f75d3cb02c2b450eb43ae528603ea614a0.69 AVAX0.001696795 26.5
0xddb8b27c5f024e2438fc9b0ff9d940f5b3d5301aedf4a3ffc1be7f7bc4e10176Enter Raffle256828112023-02-01 6:38:0438 mins ago0xc2fafbe87eb6ab93a944152abdf1827bfd3e8d39 IN  0xea82821f75d3cb02c2b450eb43ae528603ea614a0.8 AVAX0.001696795 26.5
0xacef5aca25348b796a89e112b86fc8954f6d51818f97c3338da8ade2d7988b52Enter Raffle256827842023-02-01 6:37:1038 mins ago0xc2fafbe87eb6ab93a944152abdf1827bfd3e8d39 IN  0xea82821f75d3cb02c2b450eb43ae528603ea614a1.21 AVAX0.001696795 26.5
0x6190f83b0d855293da50c6edd2daa67a4dc24f8c200358ed6dfd13f7f2a84045Enter Raffle256827692023-02-01 6:36:3939 mins ago0x135bd891920e13ea0980fcb02e85222f7915d0ee IN  0xea82821f75d3cb02c2b450eb43ae528603ea614a1.38 AVAX0.001696795 26.5
0x520a82565aacef13784de7e9e1b1a5f3b8c67bbadc4ea2630c21d7b2f4489d2cEnter Raffle256827582023-02-01 6:36:1739 mins ago0xc2fafbe87eb6ab93a944152abdf1827bfd3e8d39 IN  0xea82821f75d3cb02c2b450eb43ae528603ea614a1 AVAX0.001696795 26.5
0x66a5bfe8aebdacaf9bf6bda94f4e2ece9f7f3f98ef99344273fbe9273a2c6dbfEnter Raffle256827542023-02-01 6:36:0940 mins ago0x45b6ac5caeb044725e4974ceebf66dfe522ccc90 IN  0xea82821f75d3cb02c2b450eb43ae528603ea614a1.38 AVAX0.001696795 26.5
0xaabda9d70562faf67dd4a8ad3def2666fd7b730f05fd868bde75371d48e5153eEnter Raffle256825712023-02-01 6:30:0246 mins ago0x1f58d9b78581437eee2fd26418a057eb702c9c6c IN  0xea82821f75d3cb02c2b450eb43ae528603ea614a0.2 AVAX0.001696795 26.5
0x7abdc715e183a4d2e5a53c828eef621799a2ce52f50c7642fc680174ca2649bdEnter Raffle256825032023-02-01 6:27:4648 mins ago0x1f58d9b78581437eee2fd26418a057eb702c9c6c IN  0xea82821f75d3cb02c2b450eb43ae528603ea614a0.1 AVAX0.001696795 26.5
0x2489b6469439ce9dcc8615566b260ec2c6828cef5a9bbc1ca8674931f7534f57Enter Raffle256823052023-02-01 6:21:1054 mins ago0x85a3d5b0405589e700b3153d294a1b92eb9e2e41 IN  0xea82821f75d3cb02c2b450eb43ae528603ea614a0.69 AVAX0.001696795 26.5
0x9dd2a58b796c0d474490f004e4cdd3f98232159d3a7e86386f90f5b6e2c8eb26Enter Raffle256823022023-02-01 6:21:0455 mins ago0xe80113462d62b791b9eaee68824c6531d0479881 IN  0xea82821f75d3cb02c2b450eb43ae528603ea614a0.69 AVAX0.00176082527.5
0xeb6b617bdfab9babd33cfe6df0bcd05bf761c85fcaa984f6508fff7713c6b88eEnter Raffle256822932023-02-01 6:20:4655 mins ago0x1f58d9b78581437eee2fd26418a057eb702c9c6c IN  0xea82821f75d3cb02c2b450eb43ae528603ea614a0.1 AVAX0.001696795 26.5
0xc741e6722680627b30b562255aa47a669cf9037004bc8f99ab2686d40bdfc9ccEnter Raffle256822742023-02-01 6:20:0956 mins ago0x1f58d9b78581437eee2fd26418a057eb702c9c6c IN  0xea82821f75d3cb02c2b450eb43ae528603ea614a0.16 AVAX0.0017249682 26.94
0x2ab7a522904fba2111a61ed68b54b6fecaec82a769726b4556cc2f97748ad385Enter Raffle256822672023-02-01 6:19:5456 mins ago0xea9e119dd27536d8c4841fe4a71534a2964da206 IN  0xea82821f75d3cb02c2b450eb43ae528603ea614a0.1 AVAX0.001696795 26.5
0x954e873f84e176ba213f168344c9a7c53c5b37d7c1085adf3a89a877f3ab75fcEnter Raffle256822502023-02-01 6:19:1956 mins ago0x1f58d9b78581437eee2fd26418a057eb702c9c6c IN  0xea82821f75d3cb02c2b450eb43ae528603ea614a0.16 AVAX0.001696795 26.5
0x67d86c753fc6c37a1017c25f96e2a8e95c9ee992c00a140c7e969ffe8e1ae690Enter Raffle256822362023-02-01 6:18:5457 mins ago0x427fc18574fdcea50631876a0c7ccdab81cf67b3 IN  0xea82821f75d3cb02c2b450eb43ae528603ea614a0.69 AVAX0.001696795 26.5
0xa5d140bf264255f4c4c2440d8fb6266c1759d903fa16fdf8e548975b2d5d149dEnter Raffle256822312023-02-01 6:18:4457 mins ago0x1f58d9b78581437eee2fd26418a057eb702c9c6c IN  0xea82821f75d3cb02c2b450eb43ae528603ea614a0.14 AVAX0.001703323178 26.601955
0xc84ad707aea30b2f588b3752d404589136987a7d5ad596432ecb92f5dda0f825Enter Raffle256822102023-02-01 6:18:0258 mins ago0x1f58d9b78581437eee2fd26418a057eb702c9c6c IN  0xea82821f75d3cb02c2b450eb43ae528603ea614a0.1 AVAX0.001696795 26.5
0x650f75d55ee99b2400e28afbeb28705b3a72f21bf8eb10c97cf0565de5e579dfEnter Raffle256821582023-02-01 6:16:1859 mins ago0x1f58d9b78581437eee2fd26418a057eb702c9c6c IN  0xea82821f75d3cb02c2b450eb43ae528603ea614a0.09 AVAX0.001696795 26.5
0xdc0343681fbe6d9a96c0986c847c59460d799f253eb1029e278e0f3bf139a208Enter Raffle256817512023-02-01 6:02:391 hr 13 mins ago0xc477d4229d6c8163232fec97a4623c0b22ce1f0b IN  0xea82821f75d3cb02c2b450eb43ae528603ea614a0.15 AVAX0.001696795 26.5
0x37b7c519e9ce0bd8bfb3e31ca0f7f1a768b1b1c999b44413cf4e17e3ec0fd51aEnter Raffle256816752023-02-01 6:00:061 hr 16 mins ago0xc477d4229d6c8163232fec97a4623c0b22ce1f0b IN  0xea82821f75d3cb02c2b450eb43ae528603ea614a0.06 AVAX0.001696795 26.5
0xa3a39fb69bddd71a16708a4aa713c7a73add79641ab240ca6a569a7ec9a2fc05Enter Raffle256816242023-02-01 5:58:111 hr 17 mins ago0xc477d4229d6c8163232fec97a4623c0b22ce1f0b IN  0xea82821f75d3cb02c2b450eb43ae528603ea614a0.05 AVAX0.001696795 26.5
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x5752db52e59c8ae1cb1318553f55b1d0d21135b68264f5ff23dec486c603debe256789282023-02-01 4:27:522 hrs 48 mins ago 0xea82821f75d3cb02c2b450eb43ae528603ea614a 0x8cd2b80bacc54a309522b2208a9094d7168794680.036 AVAX
0x5752db52e59c8ae1cb1318553f55b1d0d21135b68264f5ff23dec486c603debe256789282023-02-01 4:27:522 hrs 48 mins ago 0xea82821f75d3cb02c2b450eb43ae528603ea614a0x7233d5dc6e97ed59d774dec5a857232516ee75000.764 AVAX
0x7f8151653aa52d4d0b55efb751a31cb71150976a256a9df976eeec3df1a08a67256785162023-02-01 4:14:023 hrs 2 mins ago 0xea82821f75d3cb02c2b450eb43ae528603ea614a 0x8cd2b80bacc54a309522b2208a9094d7168794680.0028 AVAX
0x7f8151653aa52d4d0b55efb751a31cb71150976a256a9df976eeec3df1a08a67256785162023-02-01 4:14:023 hrs 2 mins ago 0xea82821f75d3cb02c2b450eb43ae528603ea614a0x9b15f13e0c3180aee2963b5fba6c0a1c71ddd1eb0.0672 AVAX
0xa7a781a879d8501d56078a7212ca0ea804a0cedacbcdea6d8d5f737d9a9f6102256781162023-02-01 4:00:403 hrs 15 mins ago 0xea82821f75d3cb02c2b450eb43ae528603ea614a 0x8cd2b80bacc54a309522b2208a9094d7168794680.005 AVAX
0xa7a781a879d8501d56078a7212ca0ea804a0cedacbcdea6d8d5f737d9a9f6102256781162023-02-01 4:00:403 hrs 15 mins ago 0xea82821f75d3cb02c2b450eb43ae528603ea614a0xb026fd46d720e4e1aa53750eb97bad6edecc80600.095 AVAX
0xcda228f4370d3abc728809f6c9c1b6156388b5d88f6a03082977c023dca9e7bc256780412023-02-01 3:58:103 hrs 17 mins ago 0xea82821f75d3cb02c2b450eb43ae528603ea614a 0x8cd2b80bacc54a309522b2208a9094d7168794680.0025 AVAX
0xcda228f4370d3abc728809f6c9c1b6156388b5d88f6a03082977c023dca9e7bc256780412023-02-01 3:58:103 hrs 17 mins ago 0xea82821f75d3cb02c2b450eb43ae528603ea614a0x95894a9da8596206545787300f2e77c5b68e5ac60.0475 AVAX
0x666b2ccba28ae0aae2b7e7790f776a1d2f69a25c55050e8035b1de2bca6d9f91256779492023-02-01 3:55:063 hrs 21 mins ago 0xea82821f75d3cb02c2b450eb43ae528603ea614a 0x8cd2b80bacc54a309522b2208a9094d7168794680.025 AVAX
0x666b2ccba28ae0aae2b7e7790f776a1d2f69a25c55050e8035b1de2bca6d9f91256779492023-02-01 3:55:063 hrs 21 mins ago 0xea82821f75d3cb02c2b450eb43ae528603ea614a0xb026fd46d720e4e1aa53750eb97bad6edecc80600.475 AVAX
0x89a7e6d4c107bb061e8633f0775e9d526f78e48d55c1ddeaee530c82d967a3ca256777352023-02-01 3:47:573 hrs 28 mins ago 0xea82821f75d3cb02c2b450eb43ae528603ea614a 0x8cd2b80bacc54a309522b2208a9094d7168794680.005 AVAX
0x89a7e6d4c107bb061e8633f0775e9d526f78e48d55c1ddeaee530c82d967a3ca256777352023-02-01 3:47:573 hrs 28 mins ago 0xea82821f75d3cb02c2b450eb43ae528603ea614a0xb026fd46d720e4e1aa53750eb97bad6edecc80600.095 AVAX
0x1a94ecfe8687ec631e5e87b43f233bacafa7608778600be3f253fda77f22e6b8256776542023-02-01 3:45:153 hrs 30 mins ago 0xea82821f75d3cb02c2b450eb43ae528603ea614a 0x8cd2b80bacc54a309522b2208a9094d7168794680.065 AVAX
0x1a94ecfe8687ec631e5e87b43f233bacafa7608778600be3f253fda77f22e6b8256776542023-02-01 3:45:153 hrs 30 mins ago 0xea82821f75d3cb02c2b450eb43ae528603ea614a0x196b0fe81c90d5762dc8e96e7d96fdd8caa4c58e1.235 AVAX
0xb68146df98a9353f0f91f24a37462f9e26c645390e56329e5be322bd05e34522256751102023-02-01 2:20:124 hrs 55 mins ago 0xea82821f75d3cb02c2b450eb43ae528603ea614a 0x8cd2b80bacc54a309522b2208a9094d7168794680.1325 AVAX
0xb68146df98a9353f0f91f24a37462f9e26c645390e56329e5be322bd05e34522256751102023-02-01 2:20:124 hrs 55 mins ago 0xea82821f75d3cb02c2b450eb43ae528603ea614a0x41c8814b1e52b77167d1ea2156ec30ff736a2d0b2.5175 AVAX
0xafc1e655791ed1699f3a15a2d5c7084b5de2ab2907b619636c0ee8b521aebc0a256694362023-01-31 23:09:428 hrs 6 mins ago 0xea82821f75d3cb02c2b450eb43ae528603ea614a 0x8cd2b80bacc54a309522b2208a9094d7168794680.02 AVAX
0xafc1e655791ed1699f3a15a2d5c7084b5de2ab2907b619636c0ee8b521aebc0a256694362023-01-31 23:09:428 hrs 6 mins ago 0xea82821f75d3cb02c2b450eb43ae528603ea614a0x6cb515c864a7b4a5e4b8ab5ab4f558086a7f69c20.38 AVAX
0x247f8a8bd4742b324861f9ca9b763379deb5a3cb66b85d6907e8c6b82426a979256686802023-01-31 22:45:208 hrs 30 mins ago 0xea82821f75d3cb02c2b450eb43ae528603ea614a 0x8cd2b80bacc54a309522b2208a9094d7168794680.51 AVAX
0x247f8a8bd4742b324861f9ca9b763379deb5a3cb66b85d6907e8c6b82426a979256686802023-01-31 22:45:208 hrs 30 mins ago 0xea82821f75d3cb02c2b450eb43ae528603ea614a0xf1376072ae0e2e114ce40a3b43609a46ea99d34812.24 AVAX
0x6118235d50e17b70aa3d747a87b634244537f1904c099fd2eeb2a4ed1da717b6256682762023-01-31 22:31:518 hrs 44 mins ago 0xea82821f75d3cb02c2b450eb43ae528603ea614a 0x8cd2b80bacc54a309522b2208a9094d7168794680.085 AVAX
0x6118235d50e17b70aa3d747a87b634244537f1904c099fd2eeb2a4ed1da717b6256682762023-01-31 22:31:518 hrs 44 mins ago 0xea82821f75d3cb02c2b450eb43ae528603ea614a0xd0db1f4bd228f09a5e0dbf72e90967ab25cf651b1.615 AVAX
0x8549da4ec6821def0fd4436a00e3a5b539fb5092d43878956f8210c65e45ec38256677092023-01-31 22:12:429 hrs 3 mins ago 0xea82821f75d3cb02c2b450eb43ae528603ea614a 0x8cd2b80bacc54a309522b2208a9094d7168794680.0024 AVAX
0x8549da4ec6821def0fd4436a00e3a5b539fb5092d43878956f8210c65e45ec38256677092023-01-31 22:12:429 hrs 3 mins ago 0xea82821f75d3cb02c2b450eb43ae528603ea614a0x9b15f13e0c3180aee2963b5fba6c0a1c71ddd1eb0.0576 AVAX
0x91fe795ef765be172409cf0129daaa59872f7b9b2a090cc47bd109df49091468256676642023-01-31 22:11:129 hrs 4 mins ago 0xea82821f75d3cb02c2b450eb43ae528603ea614a 0x8cd2b80bacc54a309522b2208a9094d7168794680.002 AVAX
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Rafflr

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 11 : AutomationCompatibleInterface.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface AutomationCompatibleInterface {
  /**
   * @notice method that is simulated by the keepers to see if any work actually
   * needs to be performed. This method does does not actually need to be
   * executable, and since it is only ever simulated it can consume lots of gas.
   * @dev To ensure that it is never called, you may want to add the
   * cannotExecute modifier from KeeperBase to your implementation of this
   * method.
   * @param checkData specified in the upkeep registration so it is always the
   * same for a registered upkeep. This can easily be broken down into specific
   * arguments using `abi.decode`, so multiple upkeeps can be registered on the
   * same contract and easily differentiated by the contract.
   * @return upkeepNeeded boolean to indicate whether the keeper should call
   * performUpkeep or not.
   * @return performData bytes that the keeper should call performUpkeep with, if
   * upkeep is needed. If you would like to encode data to decode later, try
   * `abi.encode`.
   */
  function checkUpkeep(bytes calldata checkData) external returns (bool upkeepNeeded, bytes memory performData);

  /**
   * @notice method that is actually executed by the keepers, via the registry.
   * The data returned by the checkUpkeep simulation will be passed into
   * this method to actually be executed.
   * @dev The input to this method should not be trusted, and the caller of the
   * method should not even be restricted to any single registry. Anyone should
   * be able call it, and the input should be validated, there is no guarantee
   * that the data passed in is the performData returned from checkUpkeep. This
   * could happen due to malicious keepers, racing keepers, or simply a state
   * change while the performUpkeep transaction is waiting for confirmation.
   * Always validate the data passed in.
   * @param performData is the data which was passed back from the checkData
   * simulation. If it is encoded, it can easily be decoded into other types by
   * calling `abi.decode`. This data should not be trusted, and should be
   * validated against the contract's current state.
   */
  function performUpkeep(bytes calldata performData) external;
}

File 2 of 11 : KeeperCompatibleInterface.sol
// SPDX-License-Identifier: MIT
/**
 * @notice This is a deprecated interface. Please use AutomationCompatibleInterface directly.
 */
pragma solidity ^0.8.0;
import {AutomationCompatibleInterface as KeeperCompatibleInterface} from "./AutomationCompatibleInterface.sol";

File 3 of 11 : 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;

  /*
   * @notice Check to see if there exists a request commitment consumers
   * for all consumers and keyhashes for a given sub.
   * @param subId - ID of the subscription
   * @return true if there exists at least one unfulfilled request for the subscription, false
   * otherwise.
   */
  function pendingRequestExists(uint64 subId) external view returns (bool);
}

File 4 of 11 : 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 5 of 11 : 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 6 of 11 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) external;

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);
}

File 7 of 11 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

File 8 of 11 : ERC721Holder.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/utils/ERC721Holder.sol)

pragma solidity ^0.8.0;

import "../IERC721Receiver.sol";

/**
 * @dev Implementation of the {IERC721Receiver} interface.
 *
 * Accepts all token transfers.
 * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}.
 */
contract ERC721Holder is IERC721Receiver {
    /**
     * @dev See {IERC721Receiver-onERC721Received}.
     *
     * Always returns `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address,
        address,
        uint256,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC721Received.selector;
    }
}

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

pragma solidity ^0.8.0;

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

File 11 of 11 : Rafflr.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
import "@chainlink/contracts/src/v0.8/interfaces/VRFCoordinatorV2Interface.sol";
import "@chainlink/contracts/src/v0.8/VRFConsumerBaseV2.sol";
import "@chainlink/contracts/src/v0.8/interfaces/KeeperCompatibleInterface.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";


interface IRaffleRakeCalculator {
    function getRakeForRaffle(uint256 raffleId, address creator) external view returns (uint32);
}
/// @title Rafflr!
/// @author Smitty
/// @notice A contract letting users sell raffle tickets for their NFTs
contract Rafflr is VRFConsumerBaseV2, KeeperCompatibleInterface, Ownable, ERC721Holder {

    enum RaffleState {
        NONEXISTENT,
        OPEN,
        CALCULATING,
        CLOSED
    }

    struct RaffleInfo {
        uint32 ticketMax;
        uint32 ticketCurrent;
        address creator;
        RaffleState state;
        address winner;
        uint256 raffleId;
        uint256 endTime;
        uint256 startTime;
        address nftContract;
        uint256 nftId;
        uint256 ticketPrice;
    }

    struct TicketRange {
        address entrant;
        uint32 from;
        uint32 to;
    }

    event RaffleStarted(address indexed creator, address indexed nftContract, uint256 nftId, uint256 indexed endTime, uint256 raffleId, uint256 ticketPrice, uint32 ticketMax, address gateNft);
    event WinnerPicked(address indexed winner, uint256 indexed raffleId);
    event RaffleEnter(address indexed player, uint256 indexed raffleId, uint32 indexed ticketCount);
    event RequestedRaffleWinner(uint256 indexed requestId, uint256 indexed raffleToClose);
    event RaffleClosed(uint256 indexed raffleId);

    VRFCoordinatorV2Interface private vrfCoordinator;
    uint16 private _requestConfirmations = 3;
    uint32 private constant NUM_WORDS = 1;
    uint32 private _callbackGasLimit;
    bytes32 private _gasLane;
    uint64 private _subscriptionId;

    /// @notice minimum length a raffle can last
    uint256 public minRaffleLength = 86400;
    /// @notice maximum length a raffle can last
    uint256 public maxRaffleLength = 86400 * 7;

    /// @notice upkeep checks will search all raffles created within this timeframe;
    /// @dev set separately from maxRaffleLength in case we change max length later
    uint256 public upkeepLookbackTime = 86400 * 7;

    /// @notice minimum allowed ticket price
    uint256 public minTicketPrice = .1 ether;

    /// @notice ticket prices must be a multiple of this
    uint256 public ticketMultiple = .01 ether;

    /// @notice maximum allowed ticket price
    uint256 public maxTicketPrice = 100 ether;

    /// @notice maximum allowed ticket amount
    uint32 public maxTicketAmount = 10000;

    /// @notice minimum allowed ticket amount
    uint32 public minTicketAmount = 10;

    /// @notice address to receive team's raffle sale percentage
    address public teamAddress = 0x8cD2B80bacC54A309522B2208A9094d716879468;

    /// @notice address of the rake calculator
    address public raffleRakeCalculator;

    /// @notice global switch to disallow raffle creation
    bool public openForRaffles = true;

    /// @notice incrementing counter for the current raffleId
    uint256 public currentRaffleId;

    /// @notice raffle info structs mapped by raffleId
    mapping(uint256 => RaffleInfo) public raffleById;

    /// @notice raffle ids mapped by VRF request ID
    /// @dev keeps track of which request was for which raffle, so they can be fulfilled
    mapping(uint256 => uint256) public raffleByRequestId;

    /// @notice Keeps track of the ticket numbers entrants own in each raffle
    mapping(uint256 => TicketRange[]) public ticketRangeByRaffle;

    /// @notice contracts that are not allowed to be raffled
    mapping(address => bool) public blacklist;

    /// @notice contracts that are allowed to be raffled
    mapping(address => bool) public whitelist;

    /// @notice Keeps track of token gated raffles
    mapping(uint256 => address) public tokenGateByRaffle;

    bool public useWhitelist = false;

    /// @dev contracts are not allowed to enter/create raffles
    modifier isEOA() {
        require(tx.origin == msg.sender);
        _;
    }

    /// @notice so the contract can be funded in case of emergency
    receive() external payable {}

    /// @dev constructor
    constructor(
        address vrfCoordinatorV2,
        bytes32 gasLane,
        uint64 subscriptionId,
        uint32 callbackGasLimit
    ) VRFConsumerBaseV2(vrfCoordinatorV2) {
        vrfCoordinator = VRFCoordinatorV2Interface(vrfCoordinatorV2);
        _gasLane = gasLane;
        _subscriptionId = subscriptionId;
        _callbackGasLimit = callbackGasLimit;
    }

    function _createRaffle(
        address nftContract,
        uint256 nftId,
        uint256 endTime,
        uint256 ticketPrice,
        uint32 ticketMax
    ) internal {
        require(openForRaffles, "Raffles are closed");
        require(!blacklist[nftContract], "NFT blacklisted");
        if( useWhitelist ) {
            require(whitelist[nftContract], "NFT not whitelisted");
        }
        _validateRaffleParameters(endTime, ticketPrice, ticketMax);

        IERC721 nft = IERC721(nftContract);
        nft.transferFrom(msg.sender, address(this), nftId);
        currentRaffleId++;

        RaffleInfo memory ri;
        ri.nftContract = nftContract;
        ri.nftId = nftId;
        ri.endTime = endTime;
        ri.startTime = block.timestamp;
        ri.ticketPrice = ticketPrice;
        ri.ticketMax = ticketMax;
        ri.creator = msg.sender;
        ri.state = RaffleState.OPEN;
        ri.raffleId = currentRaffleId;

        raffleById[currentRaffleId] = ri;
    }

    /// @notice creates a new raffle
    /// @dev Requires permission to access the NFT to be raffled (transfers it to contract)
    function createRaffle(
        address nftContract,
        uint256 nftId,
        uint256 endTime,
        uint256 ticketPrice,
        uint32 ticketMax
    ) external isEOA {
        _createRaffle(nftContract, nftId, endTime, ticketPrice, ticketMax);
        emit RaffleStarted(msg.sender, nftContract, nftId, endTime, currentRaffleId, ticketPrice, ticketMax, address(0));
    }

    /// @notice creates a new token-gated raffle
    /// @dev Requires permission to access the NFT to be raffled (transfers it to contract)
    function createGatedRaffle(
        address nftContract,
        uint256 nftId,
        uint256 endTime,
        uint256 ticketPrice,
        uint32 ticketMax,
        address gatingNft
    ) external isEOA {
        _createRaffle(nftContract, nftId, endTime, ticketPrice, ticketMax);
        tokenGateByRaffle[currentRaffleId] = gatingNft;
        emit RaffleStarted(msg.sender, nftContract, nftId, endTime, currentRaffleId, ticketPrice, ticketMax, gatingNft);
    }


    /// @notice enters the sender into a raffle with ticketCount tickets
    function enterRaffle(uint256 raffleId, uint32 ticketCount) external payable isEOA {
        RaffleInfo storage ri = raffleById[raffleId];
        require(block.timestamp < ri.endTime, "Too late to enter");
        require(msg.value >= ri.ticketPrice * ticketCount, "Not enough AVAX");
        require(ri.state == RaffleState.OPEN, "Not open");
        require(ri.ticketCurrent + ticketCount <= ri.ticketMax, "No tickets left");
        if( tokenGateByRaffle[raffleId] != address(0) ) {
            IERC721 nft = IERC721(tokenGateByRaffle[raffleId]);
            require(nft.balanceOf(msg.sender) > 0, "Raffle is gated!");
        }
        TicketRange memory ticketRange;
        ticketRange.entrant = msg.sender;
        ticketRange.from = ri.ticketCurrent;
        ticketRange.to = ri.ticketCurrent + ticketCount-1;
        ri.ticketCurrent+= ticketCount;
        ticketRangeByRaffle[raffleId].push(ticketRange);

        emit RaffleEnter(msg.sender, raffleId, ticketCount);
    }

    /// @notice Allows raffle creator to cancel a raffle if no tickets were bought
    function cancelRaffle(uint256 raffleId) external isEOA {
        RaffleInfo storage ri = raffleById[raffleId];
        address creator = ri.creator;
        require(msg.sender == creator, "Did not create this");
        require(ri.ticketCurrent < 1, "Tickets already sold");
        ri.state = RaffleState.CLOSED;
        IERC721 nft = IERC721(ri.nftContract);
        nft.transferFrom(address(this), creator, ri.nftId);
        emit RaffleClosed(raffleId);
    }

    /** ========= Validation/Utils ======= */

    /// @dev validates that a raffle's endTime, ticketPrice, and ticketMax are within limits
    function _validateRaffleParameters(
        uint256 endTime,
        uint256 ticketPrice,
        uint256 ticketMax
    ) private view {
        require(endTime - block.timestamp >= minRaffleLength, "Raffle too short");
        require(endTime - block.timestamp <= maxRaffleLength, "Raffle too long");
        require(ticketPrice >= minTicketPrice, "Ticket price too low");
        require(ticketPrice <= maxTicketPrice, "Ticket price too low");
        require(ticketPrice % ticketMultiple == 0, "Bad price fidelity");
        require(ticketMax >= minTicketAmount, "Too few tickets");
        require(ticketMax <= maxTicketAmount, "Too many tickets");
    }

    /// @dev Validates that a raffle is open and past it's end time
    function _isRaffleReadyToClose( RaffleInfo memory ri) private view returns (bool) {
        bool isOpen = ri.state == RaffleState.OPEN;
        bool isTimeToClose = ri.endTime <= block.timestamp || ri.ticketCurrent >= ri.ticketMax;
        return isOpen && isTimeToClose;
    }

    /// @dev Given a raffleId and a winning ticket, finds the owner of the ticket with a binary search
    function _getWinnerFromRaffleAndIndex( uint256 raffleId, uint256 ticketIndex ) private view returns (address) {
        RaffleInfo memory ri = raffleById[raffleId];
        require(ticketIndex < ri.ticketCurrent, "Index doesn't exist");

        TicketRange[] memory ranges = ticketRangeByRaffle[raffleId];

        uint256 totalTicketRanges = ranges.length;

        require(ranges[0].from == 0);
        require(ranges[totalTicketRanges - 1].to == ri.ticketCurrent - 1);

        uint256 low = 0;
        uint256 high = totalTicketRanges - 1;
        uint256 mid = (low + high) / 2;
        address ownerAddress;

        while (ownerAddress == address(0)) {
            mid = (low + high) / 2;
            TicketRange memory range = ranges[mid];
            if (range.to < ticketIndex) {
                low = mid + 1;
            } else if (range.from > ticketIndex) {
                high = mid - 1;
            } else {
                ownerAddress = range.entrant;
            }
        }

        return ownerAddress;
    }

    /** ========= Chainlink integration ======= */

    /// @notice Checks to see if there's a raffle that requires upkeep (ending)
    /// @dev Starting from most recent raffle, moves back until it finds one that is past endTime or started longer than upkeepLookbackTime ago
    /// @dev Also returns the raffleId encoded to be sent to the performUpkeep function 
    function checkUpkeep(bytes memory /*checkData*/) public view override returns (bool upkeepNeeded, bytes memory performData) {
        upkeepNeeded = false;
        uint i = currentRaffleId;
        uint curTime = block.timestamp;
        RaffleInfo memory ri = raffleById[i];
        while( i > 0 && curTime < ri.startTime + upkeepLookbackTime ) {
            if( _isRaffleReadyToClose(ri) ) {
                return (true, abi.encode(i));
            }
            i--;
            ri = raffleById[i];
        }
        return (false, "");
    }

    /// @notice Called by chainlink keeper to close a raffle
    /// @dev takes an abi encoded raffleId to close and sends out a VRF request
    function performUpkeep(bytes calldata performData) external override {
        uint256 raffleToClose = abi.decode(performData, (uint256));
        require(raffleToClose <= currentRaffleId, "Open raffle doesn't exist");
        RaffleInfo storage ri = raffleById[raffleToClose];
        require(_isRaffleReadyToClose(ri), "Raffle not ready");

        ri.state = RaffleState.CALCULATING;
        uint256 requestId = vrfCoordinator.requestRandomWords(
            _gasLane,
            _subscriptionId,
            _requestConfirmations,
            _callbackGasLimit,
            NUM_WORDS
        );
        emit RequestedRaffleWinner(requestId, raffleToClose);
        raffleByRequestId[requestId] = raffleToClose;
    }

    /// @notice receives the random number from VRF and picks a winner, closing the raffle
    /// @dev Transfers NFT to the winner, sends funds to creator/team. Auto refunds the NFT if no entries
    function fulfillRandomWords(uint256 requestId, uint256[] memory randomWords) internal override {
        uint256 raffleId = raffleByRequestId[requestId];
        RaffleInfo storage ri = raffleById[raffleId];
        IERC721 nft = IERC721(ri.nftContract);
        if( ticketRangeByRaffle[raffleId].length == 0) {
            nft.transferFrom(address(this), ri.creator, ri.nftId);
            ri.state = RaffleState.CLOSED;
            emit RaffleClosed(raffleId);
            return;
        }
        uint256 indexOfWinner = randomWords[0] % ri.ticketCurrent;

        ri.winner = _getWinnerFromRaffleAndIndex(raffleId, indexOfWinner);

        uint256 prize = ri.ticketCurrent * ri.ticketPrice;
        ri.state = RaffleState.CLOSED;
        nft.transferFrom(address(this), ri.winner, ri.nftId);

        IRaffleRakeCalculator rakeCalculator = IRaffleRakeCalculator(raffleRakeCalculator);
        uint256 rake = rakeCalculator.getRakeForRaffle(raffleId, ri.creator);

        (bool success, ) = payable(ri.creator).call{value: prize * (10000 - rake) / 10000}("");
        require(success);
        (success, ) = payable(teamAddress).call{value: (prize * rake) / 10000}("");
        require(success);

        emit WinnerPicked(ri.winner, raffleId);
    }


    /*** ========= IN CASE OF EMERGENCY ============== */

    /// @notice Returns given NFT to contract owner in case of emergency
    function rescueToken(address nftContract, uint256 nftId) external onlyOwner {
        IERC721 nft = IERC721(nftContract);
        nft.transferFrom(address(this), msg.sender, nftId);
    }

    /// @notice withdraws AVAX to contract owner in case of emergency
    function rescueAvax(uint256 amount) external onlyOwner {
        (bool success, ) = payable(msg.sender).call{value: amount}("");
        require(success);
    }

    /// @notice triggers VRF process for a given raffle in case of emergency
    function forceRequestWinner(uint256 raffleId) external onlyOwner {
        RaffleInfo storage ri = raffleById[raffleId];
        require(ri.state != RaffleState.CLOSED, "already closed");
        ri.state = RaffleState.CALCULATING;
        uint256 requestId = vrfCoordinator.requestRandomWords(
            _gasLane,
            _subscriptionId,
            _requestConfirmations,
            _callbackGasLimit,
            NUM_WORDS
        );
        raffleByRequestId[requestId] = raffleId;
        emit RequestedRaffleWinner(requestId, raffleId);
    }

    /// @notice sends NFT back to raffle creator, refunds all entrants in case of emergency
    function fullRefundRaffle(uint256 raffleId) external onlyOwner {
        RaffleInfo storage ri = raffleById[raffleId];
        ri.state = RaffleState.CLOSED;
        
        // Return NFT to creator of raffle
        IERC721 nft = IERC721(ri.nftContract);
        nft.transferFrom(address(this), ri.creator, ri.nftId);

        TicketRange[] memory ranges = ticketRangeByRaffle[raffleId];
        uint256 totalTicketRanges = ranges.length;
        bool success;
        // Refund all ticket purchasers
        for( uint i = 0; i < totalTicketRanges; i++ ) {
            TicketRange memory range = ranges[i];
            (success, ) = payable(range.entrant).call{value: (range.to - range.from + 1)*ri.ticketPrice}("");
            require(success);
        }

        emit RaffleClosed(raffleId);
    }

    /*** ======= Getters/Setters ======= ***/

    function getRaffleInfo(uint256 raffleId) public view returns (RaffleInfo memory) {
        return raffleById[raffleId];
    }

    function getTicketRangeFromRaffle(uint256 raffleId) public view returns (TicketRange[] memory) {
        return ticketRangeByRaffle[raffleId];
    }

    function getManyRaffleInfo(uint256[] memory raffleIds) public view returns (RaffleInfo[] memory) {
        RaffleInfo[] memory ret = new RaffleInfo[](raffleIds.length);
        uint raffleIdLength = raffleIds.length;
        for( uint i = 0; i < raffleIdLength; ++i ) {
            ret[i] = raffleById[raffleIds[i]];
        }

        return ret;
    }

    function setMinRaffleLength(uint256 length) external onlyOwner {
        minRaffleLength = length;
    }

    function setMaxRaffleLength(uint256 length) external onlyOwner {
        maxRaffleLength = length;
    }

    function setUpkeepLookbackTime(uint256 length) external onlyOwner {
        upkeepLookbackTime = length;
    }

    function setTicketMultiple(uint256 multiple) external onlyOwner {
        ticketMultiple = multiple;
    }

    function setMinTicketPrice(uint256 price) external onlyOwner {
        minTicketPrice = price;
    }

    function setMaxTicketPrice(uint256 price) external onlyOwner {
        maxTicketPrice = price;
    }

    function setMaxTicketAmount(uint32 amount) external onlyOwner {
        maxTicketAmount = amount;
    }

    function setMinTicketAmount(uint32 amount) external onlyOwner {
        minTicketAmount = amount;
    }

    function getNumWords() public pure returns (uint256) {
        return NUM_WORDS;
    }

    function getRequestConfirmations() public view returns (uint16) {
        return _requestConfirmations;
    }

    function setRequestConfirmations(uint16 requestConfirmations) public onlyOwner {
        _requestConfirmations = requestConfirmations;
    }

    function getGasLane() public view returns (bytes32) {
        return _gasLane;
    }

    function setGasLane(bytes32 gasLane) public onlyOwner {
        _gasLane = gasLane;
    }

    function getSubscriptionId() public view returns (uint64) {
        return _subscriptionId;
    }

    function setSubscriptionId(uint64 subscriptionId) public onlyOwner {
        _subscriptionId = subscriptionId;
    }

    function getCallbackGasLimit() public view returns (uint32) {
        return _callbackGasLimit;
    }

    function setCallbackGasLimit(uint32 callbackGasLimit) public onlyOwner {
        _callbackGasLimit = callbackGasLimit;
    }

    function setRaffleRakeCalculator(address _raffleRakeCalculator) public onlyOwner {
        raffleRakeCalculator = _raffleRakeCalculator;
    }

    function setTeamAddress(address teamAddress_) public onlyOwner {
        teamAddress = teamAddress_;
    }

    function setOpenForRaffles(bool openForRaffles_) public onlyOwner {
        openForRaffles = openForRaffles_;
    }

    function setCurrentRaffleId(uint256 raffleId) external onlyOwner {
        currentRaffleId = raffleId;
    }

    function setUseWhitelist(bool useWhitelist_) public onlyOwner {
        useWhitelist = useWhitelist_;
    }

    function addWhitelist(address[] memory _addressList) external onlyOwner {
		require(_addressList.length > 0, "Error: list is empty");

		for (uint256 i = 0; i < _addressList.length; i++) {
			whitelist[_addressList[i]] = true;
		}
	}

	function removeWhitelist(address[] memory addressList) external onlyOwner {
		require(addressList.length > 0, "Error: list is empty");
		for (uint256 i = 0; i < addressList.length; i++) {
			whitelist[addressList[i]] = false;
		}
	}
    
    function addBlacklist(address[] memory _addressList) external onlyOwner {
		require(_addressList.length > 0, "Error: list is empty");

		for (uint256 i = 0; i < _addressList.length; i++) {
			blacklist[_addressList[i]] = true;
		}
	}

	function removeBlacklist(address[] memory addressList) external onlyOwner {
		require(addressList.length > 0, "Error: list is empty");
		for (uint256 i = 0; i < addressList.length; i++) {
			blacklist[addressList[i]] = false;
		}
	}
}

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

Contract ABI

[{"inputs":[{"internalType":"address","name":"vrfCoordinatorV2","type":"address"},{"internalType":"bytes32","name":"gasLane","type":"bytes32"},{"internalType":"uint64","name":"subscriptionId","type":"uint64"},{"internalType":"uint32","name":"callbackGasLimit","type":"uint32"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"have","type":"address"},{"internalType":"address","name":"want","type":"address"}],"name":"OnlyCoordinatorCanFulfill","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"raffleId","type":"uint256"}],"name":"RaffleClosed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"player","type":"address"},{"indexed":true,"internalType":"uint256","name":"raffleId","type":"uint256"},{"indexed":true,"internalType":"uint32","name":"ticketCount","type":"uint32"}],"name":"RaffleEnter","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"creator","type":"address"},{"indexed":true,"internalType":"address","name":"nftContract","type":"address"},{"indexed":false,"internalType":"uint256","name":"nftId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"endTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"raffleId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"ticketPrice","type":"uint256"},{"indexed":false,"internalType":"uint32","name":"ticketMax","type":"uint32"},{"indexed":false,"internalType":"address","name":"gateNft","type":"address"}],"name":"RaffleStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"requestId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"raffleToClose","type":"uint256"}],"name":"RequestedRaffleWinner","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"winner","type":"address"},{"indexed":true,"internalType":"uint256","name":"raffleId","type":"uint256"}],"name":"WinnerPicked","type":"event"},{"inputs":[{"internalType":"address[]","name":"_addressList","type":"address[]"}],"name":"addBlacklist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_addressList","type":"address[]"}],"name":"addWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"blacklist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"raffleId","type":"uint256"}],"name":"cancelRaffle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"","type":"bytes"}],"name":"checkUpkeep","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"uint256","name":"ticketPrice","type":"uint256"},{"internalType":"uint32","name":"ticketMax","type":"uint32"},{"internalType":"address","name":"gatingNft","type":"address"}],"name":"createGatedRaffle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"uint256","name":"ticketPrice","type":"uint256"},{"internalType":"uint32","name":"ticketMax","type":"uint32"}],"name":"createRaffle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentRaffleId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"raffleId","type":"uint256"},{"internalType":"uint32","name":"ticketCount","type":"uint32"}],"name":"enterRaffle","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"raffleId","type":"uint256"}],"name":"forceRequestWinner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"raffleId","type":"uint256"}],"name":"fullRefundRaffle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getCallbackGasLimit","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getGasLane","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"raffleIds","type":"uint256[]"}],"name":"getManyRaffleInfo","outputs":[{"components":[{"internalType":"uint32","name":"ticketMax","type":"uint32"},{"internalType":"uint32","name":"ticketCurrent","type":"uint32"},{"internalType":"address","name":"creator","type":"address"},{"internalType":"enum Rafflr.RaffleState","name":"state","type":"uint8"},{"internalType":"address","name":"winner","type":"address"},{"internalType":"uint256","name":"raffleId","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"},{"internalType":"uint256","name":"ticketPrice","type":"uint256"}],"internalType":"struct Rafflr.RaffleInfo[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNumWords","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"raffleId","type":"uint256"}],"name":"getRaffleInfo","outputs":[{"components":[{"internalType":"uint32","name":"ticketMax","type":"uint32"},{"internalType":"uint32","name":"ticketCurrent","type":"uint32"},{"internalType":"address","name":"creator","type":"address"},{"internalType":"enum Rafflr.RaffleState","name":"state","type":"uint8"},{"internalType":"address","name":"winner","type":"address"},{"internalType":"uint256","name":"raffleId","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"},{"internalType":"uint256","name":"ticketPrice","type":"uint256"}],"internalType":"struct Rafflr.RaffleInfo","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRequestConfirmations","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSubscriptionId","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"raffleId","type":"uint256"}],"name":"getTicketRangeFromRaffle","outputs":[{"components":[{"internalType":"address","name":"entrant","type":"address"},{"internalType":"uint32","name":"from","type":"uint32"},{"internalType":"uint32","name":"to","type":"uint32"}],"internalType":"struct Rafflr.TicketRange[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxRaffleLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxTicketAmount","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxTicketPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minRaffleLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minTicketAmount","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minTicketPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"openForRaffles","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"performData","type":"bytes"}],"name":"performUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"raffleById","outputs":[{"internalType":"uint32","name":"ticketMax","type":"uint32"},{"internalType":"uint32","name":"ticketCurrent","type":"uint32"},{"internalType":"address","name":"creator","type":"address"},{"internalType":"enum Rafflr.RaffleState","name":"state","type":"uint8"},{"internalType":"address","name":"winner","type":"address"},{"internalType":"uint256","name":"raffleId","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"},{"internalType":"uint256","name":"ticketPrice","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"raffleByRequestId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"raffleRakeCalculator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"requestId","type":"uint256"},{"internalType":"uint256[]","name":"randomWords","type":"uint256[]"}],"name":"rawFulfillRandomWords","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"addressList","type":"address[]"}],"name":"removeBlacklist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"addressList","type":"address[]"}],"name":"removeWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"rescueAvax","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"}],"name":"rescueToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"callbackGasLimit","type":"uint32"}],"name":"setCallbackGasLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"raffleId","type":"uint256"}],"name":"setCurrentRaffleId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"gasLane","type":"bytes32"}],"name":"setGasLane","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"name":"setMaxRaffleLength","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"amount","type":"uint32"}],"name":"setMaxTicketAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"name":"setMaxTicketPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"name":"setMinRaffleLength","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"amount","type":"uint32"}],"name":"setMinTicketAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"name":"setMinTicketPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"openForRaffles_","type":"bool"}],"name":"setOpenForRaffles","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_raffleRakeCalculator","type":"address"}],"name":"setRaffleRakeCalculator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"requestConfirmations","type":"uint16"}],"name":"setRequestConfirmations","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"subscriptionId","type":"uint64"}],"name":"setSubscriptionId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"teamAddress_","type":"address"}],"name":"setTeamAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"multiple","type":"uint256"}],"name":"setTicketMultiple","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"name":"setUpkeepLookbackTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"useWhitelist_","type":"bool"}],"name":"setUseWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"teamAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ticketMultiple","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"ticketRangeByRaffle","outputs":[{"internalType":"address","name":"entrant","type":"address"},{"internalType":"uint32","name":"from","type":"uint32"},{"internalType":"uint32","name":"to","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenGateByRaffle","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"upkeepLookbackTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"useWhitelist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

60a06040526001805461ffff60a01b1916600360a01b1790556201518060045562093a80600581905560065567016345785d8a0000600755662386f26fc1000060085568056bc75e2d63100000600955600a80546001600160e01b0319167b8cd2b80bacc54a309522b2208a9094d7168794680000000a00002710179055600b8054600160a01b60ff60a01b199091161790556013805460ff19169055348015620000a957600080fd5b5060405162003eb838038062003eb8833981016040819052620000cc9162000195565b6001600160a01b038416608052620000e43362000145565b60018054600294909455600380546001600160401b039094166001600160401b03199094169390931790925563ffffffff16600160b01b02600165ffffffff000160a01b03199092166001600160a01b03909316929092171790556200020f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008060008060808587031215620001ac57600080fd5b84516001600160a01b0381168114620001c457600080fd5b6020860151604087015191955093506001600160401b0381168114620001e957600080fd5b606086015190925063ffffffff811681146200020457600080fd5b939692955090935050565b608051613c866200023260003960008181611149015261118b0152613c866000f3fe6080604052600436106103bc5760003560e01c8063715018a6116101f2578063c19dd76b1161010d578063ea7b4f77116100a0578063f3d215c31161006f578063f3d215c314610c5c578063f60e105714610c7c578063f9f92be414610c9c578063fb64bd6a14610ccc57600080fd5b8063ea7b4f7714610bdc578063ed5147df14610bfc578063edac985b14610c1c578063f2fde38b14610c3c57600080fd5b8063de3d9fb7116100dc578063de3d9fb714610b57578063de8be8e714610b7f578063e15e2b4914610ba1578063e630025a14610bc257600080fd5b8063c19dd76b14610aec578063d18967a514610b01578063d6a4ed0714610b21578063d76f3b5314610b4157600080fd5b806390c4585911610185578063a284b6d311610154578063a284b6d314610a21578063a4eb718c14610a53578063acc5100814610a73578063aec9c23e14610aa057600080fd5b806390c45859146109815780639436ec93146109a1578063955d0ed1146109c15780639b19251a146109e157600080fd5b80638824f5a7116101c15780638824f5a71461086c5780638c90f1691461088c5780638cef7148146109365780638da5cb5b1461096357600080fd5b8063715018a61461080157806372ed50d014610816578063784a29dc146108365780637911ef9d1461084c57600080fd5b80633d2cc56c116102e2578063619b6b03116102755780636690864e116102445780636690864e1461075d5780636a250ecb1461077d5780636e04ff0d146107b357806370cc91ad146107e157600080fd5b8063619b6b03146106fb57806362bb74e81461071157806365df169e146107315780636667c1031461074757600080fd5b806359821c2e116102b157806359821c2e1461066d5780635f1b0fd81461068d5780635fba3171146106bb578063616d8fdb146106db57600080fd5b80633d2cc56c146105f9578063452c5601146106195780634585e33b1461063957806353a2c19a1461065957600080fd5b80631de0be8e1161035a5780632b205dc9116103295780632b205dc9146105835780632b56065b146105a357806333f3d628146105c35780633bb091c5146105e357600080fd5b80631de0be8e146104f65780631fe543e314610516578063232452161461053657806327d7e46d1461055657600080fd5b806315e42ee51161039657806315e42ee514610457578063182912e3146104775780631c75f085146104a45780631c9ef59a146104e357600080fd5b806313f39e7f146103c8578063150b7a02146103f157806315d027371461043557600080fd5b366103c357005b600080fd5b3480156103d457600080fd5b506103de60045481565b6040519081526020015b60405180910390f35b3480156103fd57600080fd5b5061041c61040c36600461336f565b630a85bd0160e11b949350505050565b6040516001600160e01b031990911681526020016103e8565b34801561044157600080fd5b506104556104503660046133d6565b610cf0565b005b34801561046357600080fd5b506104556104723660046133ef565b610cfd565b34801561048357600080fd5b506104976104923660046133d6565b610d23565b6040516103e89190613418565b3480156104b057600080fd5b50600a546104cb90600160401b90046001600160a01b031681565b6040516001600160a01b0390911681526020016103e8565b6104556104f1366004613496565b610dbd565b34801561050257600080fd5b50600b546104cb906001600160a01b031681565b34801561052257600080fd5b50610455610531366004613554565b61113e565b34801561054257600080fd5b5061045561055136600461359a565b6111c6565b34801561056257600080fd5b506105766105713660046133d6565b611257565b6040516103e89190613726565b34801561058f57600080fd5b5061045561059e3660046133ef565b61133a565b3480156105af57600080fd5b506104556105be3660046133d6565b611355565b3480156105cf57600080fd5b506104556105de366004613735565b611362565b3480156105ef57600080fd5b506103de60095481565b34801561060557600080fd5b5061045561061436600461359a565b6113d3565b34801561062557600080fd5b506104556106343660046133d6565b611464565b34801561064557600080fd5b5061045561065436600461375f565b611471565b34801561066557600080fd5b5060016103de565b34801561067957600080fd5b506104556106883660046137d0565b6116fe565b34801561069957600080fd5b50600154600160a01b900461ffff1660405161ffff90911681526020016103e8565b3480156106c757600080fd5b506104556106d63660046133d6565b6117ac565b3480156106e757600080fd5b506104556106f6366004613831565b611923565b34801561070757600080fd5b506103de60075481565b34801561071d57600080fd5b5061045561072c3660046133d6565b611952565b34801561073d57600080fd5b506103de600c5481565b34801561075357600080fd5b506103de60055481565b34801561076957600080fd5b5061045561077836600461384e565b61195f565b34801561078957600080fd5b506104cb6107983660046133d6565b6012602052600090815260409020546001600160a01b031681565b3480156107bf57600080fd5b506107d36107ce366004613869565b611993565b6040516103e892919061389d565b3480156107ed57600080fd5b506104556107fc3660046133d6565b611be4565b34801561080d57600080fd5b50610455611c41565b34801561082257600080fd5b506104556108313660046133d6565b611c55565b34801561084257600080fd5b506103de60085481565b34801561085857600080fd5b5061045561086736600461359a565b611c62565b34801561087857600080fd5b506104556108873660046138f5565b611cf3565b34801561089857600080fd5b5061091f6108a73660046133d6565b600d602052600090815260409020805460018201546002830154600384015460048501546005860154600687015460079097015463ffffffff80881698600160201b890490911697600160401b81046001600160a01b0390811698600160e01b90920460ff169791811696919591949193911691908b565b6040516103e89b9a99989796959493929190613919565b34801561094257600080fd5b506103de6109513660046133d6565b600e6020526000908152604090205481565b34801561096f57600080fd5b506000546001600160a01b03166104cb565b34801561098d57600080fd5b5061045561099c3660046133d6565b611d1d565b3480156109ad57600080fd5b506104556109bc3660046133d6565b611e97565b3480156109cd57600080fd5b506104556109dc3660046133d6565b611ea4565b3480156109ed57600080fd5b50610a116109fc36600461384e565b60116020526000908152604090205460ff1681565b60405190151581526020016103e8565b348015610a2d57600080fd5b50600a54610a3e9063ffffffff1681565b60405163ffffffff90911681526020016103e8565b348015610a5f57600080fd5b50610455610a6e366004613831565b6120e4565b348015610a7f57600080fd5b50610a93610a8e36600461398e565b612112565b6040516103e891906139c2565b348015610aac57600080fd5b50610ac0610abb366004613a11565b6122a9565b604080516001600160a01b03909416845263ffffffff92831660208501529116908201526060016103e8565b348015610af857600080fd5b506002546103de565b348015610b0d57600080fd5b50610455610b1c366004613831565b6122f9565b348015610b2d57600080fd5b50610455610b3c3660046133d6565b61231d565b348015610b4d57600080fd5b506103de60065481565b348015610b6357600080fd5b506003546040516001600160401b0390911681526020016103e8565b348015610b8b57600080fd5b50600154600160b01b900463ffffffff16610a3e565b348015610bad57600080fd5b50600b54610a1190600160a01b900460ff1681565b348015610bce57600080fd5b50601354610a119060ff1681565b348015610be857600080fd5b50610455610bf7366004613a33565b61232a565b348015610c0857600080fd5b50610455610c1736600461384e565b612355565b348015610c2857600080fd5b50610455610c3736600461359a565b61237f565b348015610c4857600080fd5b50610455610c5736600461384e565b612410565b348015610c6857600080fd5b50610455610c77366004613a5c565b612489565b348015610c8857600080fd5b50610455610c973660046133d6565b61250f565b348015610ca857600080fd5b50610a11610cb736600461384e565b60106020526000908152604090205460ff1681565b348015610cd857600080fd5b50600a54610a3e90600160201b900463ffffffff1681565b610cf861251c565b600c55565b610d0561251c565b600b8054911515600160a01b0260ff60a01b19909216919091179055565b6060600f6000838152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b82821015610db257600084815260209081902060408051606081018252918501546001600160a01b038116835263ffffffff600160a01b8204811684860152600160c01b9091041690820152825260019092019101610d58565b505050509050919050565b323314610dc957600080fd5b6000828152600d6020526040902060038101544210610e235760405162461bcd60e51b81526020600482015260116024820152702a37b7903630ba32903a379032b73a32b960791b60448201526064015b60405180910390fd5b8163ffffffff168160070154610e399190613ac6565b341015610e7a5760405162461bcd60e51b815260206004820152600f60248201526e09cdee840cadcdeeaced04082ac82b608b1b6044820152606401610e1a565b60018154600160e01b900460ff166003811115610e9957610e99613631565b14610ed15760405162461bcd60e51b81526020600482015260086024820152672737ba1037b832b760c11b6044820152606401610e1a565b805463ffffffff80821691610eef918591600160201b900416613add565b63ffffffff161115610f355760405162461bcd60e51b815260206004820152600f60248201526e139bc81d1a58dad95d1cc81b19599d608a1b6044820152606401610e1a565b6000838152601260205260409020546001600160a01b03161561100f576000838152601260205260408082205490516370a0823160e01b81523360048201526001600160a01b03909116919082906370a0823190602401602060405180830381865afa158015610fa9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fcd9190613b01565b1161100d5760405162461bcd60e51b815260206004820152601060248201526f526166666c652069732067617465642160801b6044820152606401610e1a565b505b604080516060810182526000918101919091523381528154600160201b900463ffffffff1660208201819052600190611049908590613add565b6110539190613b1a565b63ffffffff908116604083015282548491849160049161107d918591600160201b90910416613add565b825463ffffffff9182166101009390930a9283029282021916919091179091556000868152600f60209081526040808320805460018101825590845282842087519101805493880151888401518716600160c01b0263ffffffff60c01b19918816600160a01b026001600160c01b03199096166001600160a01b0390941693909317949094179390931617909155519186169250869133917faf2aee3d8cdab65f2d45ee09beee32f3c25f465d16fa61f5c86cca3f13e8605791a450505050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146111b85760405163073e64fd60e21b81523360048201526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166024820152604401610e1a565b6111c28282612576565b5050565b6111ce61251c565b60008151116111ef5760405162461bcd60e51b8152600401610e1a90613b37565b60005b81518110156111c25760006011600084848151811061121357611213613b65565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061124f81613b7b565b9150506111f2565b61125f613232565b6000828152600d6020908152604091829020825161016081018452815463ffffffff8082168352600160201b82041693820193909352600160401b83046001600160a01b031693810193909352906060830190600160e01b900460ff1660038111156112cd576112cd613631565b60038111156112de576112de613631565b815260018201546001600160a01b03908116602083015260028301546040830152600383015460608301526004830154608083015260058301541660a0820152600682015460c082015260079091015460e09091015292915050565b61134261251c565b6013805460ff1916911515919091179055565b61135d61251c565b600755565b61136a61251c565b6040516323b872dd60e01b815282906001600160a01b038216906323b872dd9061139c90309033908790600401613b94565b600060405180830381600087803b1580156113b657600080fd5b505af11580156113ca573d6000803e3d6000fd5b50505050505050565b6113db61251c565b60008151116113fc5760405162461bcd60e51b8152600401610e1a90613b37565b60005b81518110156111c25760016010600084848151811061142057611420613b65565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061145c81613b7b565b9150506113ff565b61146c61251c565b600855565b600061147f828401846133d6565b9050600c548111156114d35760405162461bcd60e51b815260206004820152601960248201527f4f70656e20726166666c6520646f65736e2774206578697374000000000000006044820152606401610e1a565b6000818152600d6020908152604091829020825161016081018452815463ffffffff8082168352600160201b82041693820193909352600160401b83046001600160a01b031693810193909352916115b39183906060830190600160e01b900460ff16600381111561154757611547613631565b600381111561155857611558613631565b815260018201546001600160a01b03908116602083015260028301546040830152600383015460608301526004830154608083015260058301541660a0820152600682015460c082015260079091015460e090910152612941565b6115f25760405162461bcd60e51b815260206004820152601060248201526f526166666c65206e6f7420726561647960801b6044820152606401610e1a565b8054600160e11b60ff60e01b19909116178155600180546002546003546040516305d3b1d360e41b815260048101929092526001600160401b0316602482015261ffff600160a01b830416604482015263ffffffff600160b01b830416606482015260848101929092526000916001600160a01b0390911690635d3b1d309060a4016020604051808303816000875af1158015611693573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116b79190613b01565b905082817f245cf2001d5f24fa6de51693d3a2fc093ae1d1ad063bf077d1e629556f8c0d0260405160405180910390a36000908152600e6020526040902091909155505050565b32331461170a57600080fd5b611717868686868661299c565b600c805460009081526012602090815260409182902080546001600160a01b0319166001600160a01b03868116918217909255935483518a81529283015291810186905263ffffffff85166060820152608081019290925285919088169033907f8f6fdf5368e64726d02fcbc787bdbea9bb0b858bdc288b0f8e5d7e832a067da49060a00160405180910390a4505050505050565b3233146117b857600080fd5b6000818152600d602052604090208054600160401b90046001600160a01b031633811461181d5760405162461bcd60e51b8152602060048201526013602482015272446964206e6f7420637265617465207468697360681b6044820152606401610e1a565b81546001600160201b90910463ffffffff16106118735760405162461bcd60e51b8152602060048201526014602482015273151a58dad95d1cc8185b1c9958591e481cdbdb1960621b6044820152606401610e1a565b815460ff60e01b1916600360e01b178255600582015460068301546040516323b872dd60e01b81526001600160a01b039092169182916323b872dd916118c0913091879190600401613b94565b600060405180830381600087803b1580156118da57600080fd5b505af11580156118ee573d6000803e3d6000fd5b50506040518692507f2a7d48246875b5f17dc9944def25fc8fe90e524ca2165e290ffdc0e44a0bf8b69150600090a250505050565b61192b61251c565b600a805463ffffffff909216600160201b0267ffffffff0000000019909216919091179055565b61195a61251c565b600555565b61196761251c565b600a80546001600160a01b03909216600160401b02600160401b600160e01b0319909216919091179055565b600c546000818152600d60209081526040808320815161016081018352815463ffffffff8082168352600160201b82041694820194909452600160401b84046001600160a01b0316928101929092529293606093909242928692909186830190600160e01b900460ff166003811115611a0e57611a0e613631565b6003811115611a1f57611a1f613631565b815260018201546001600160a01b03908116602083015260028301546040830152600383015460608301526004830154608083015260058301541660a0820152600682015460c082015260079091015460e09091015290505b600083118015611a9857506006548160e00151611a959190613bb8565b82105b15611bc657611aa681612941565b15611adb57600183604051602001611ac091815260200190565b60405160208183030381529060405294509450505050915091565b82611ae581613bcb565b6000818152600d6020908152604091829020825161016081018452815463ffffffff8082168352600160201b82041693820193909352600160401b83046001600160a01b0316938101939093529296509092506060830190600160e01b900460ff166003811115611b5857611b58613631565b6003811115611b6957611b69613631565b815260018201546001600160a01b03908116602083015260028301546040830152600383015460608301526004830154608083015260058301541660a0820152600682015460c082015260079091015460e0909101529050611a78565b60006040518060200160405280600081525094509450505050915091565b611bec61251c565b604051600090339083908381818185875af1925050503d8060008114611c2e576040519150601f19603f3d011682016040523d82523d6000602084013e611c33565b606091505b50509050806111c257600080fd5b611c4961251c565b611c536000612cb9565b565b611c5d61251c565b600255565b611c6a61251c565b6000815111611c8b5760405162461bcd60e51b8152600401610e1a90613b37565b60005b81518110156111c257600060106000848481518110611caf57611caf613b65565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580611ceb81613b7b565b915050611c8e565b611cfb61251c565b6001805461ffff909216600160a01b0261ffff60a01b19909216919091179055565b611d2561251c565b6000818152600d6020526040902060038154600160e01b900460ff166003811115611d5257611d52613631565b03611d905760405162461bcd60e51b815260206004820152600e60248201526d185b1c9958591e4818db1bdcd95960921b6044820152606401610e1a565b8054600160e11b60ff60e01b19909116178155600180546002546003546040516305d3b1d360e41b815260048101929092526001600160401b0316602482015261ffff600160a01b830416604482015263ffffffff600160b01b830416606482015260848101929092526000916001600160a01b0390911690635d3b1d309060a4016020604051808303816000875af1158015611e31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e559190613b01565b6000818152600e602052604080822086905551919250849183917f245cf2001d5f24fa6de51693d3a2fc093ae1d1ad063bf077d1e629556f8c0d0291a3505050565b611e9f61251c565b600455565b611eac61251c565b6000818152600d602052604090819020805460ff60e01b1916600360e01b178082556005820154600683015493516323b872dd60e01b815292936001600160a01b039182169384936323b872dd93611f14933093600160401b90930490911691600401613b94565b600060405180830381600087803b158015611f2e57600080fd5b505af1158015611f42573d6000803e3d6000fd5b505050506000600f6000858152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b82821015611fd557600084815260209081902060408051606081018252918501546001600160a01b038116835263ffffffff600160a01b8204811684860152600160c01b9091041690820152825260019092019101611f7b565b50508251929350600091508190505b828110156120b057600084828151811061200057612000613b65565b6020026020010151905080600001516001600160a01b03168760070154826020015183604001516120319190613b1a565b61203c906001613add565b63ffffffff1661204c9190613ac6565b604051600081818185875af1925050503d8060008114612088576040519150601f19603f3d011682016040523d82523d6000602084013e61208d565b606091505b5050809350508261209d57600080fd5b50806120a881613b7b565b915050611fe4565b5060405186907f2a7d48246875b5f17dc9944def25fc8fe90e524ca2165e290ffdc0e44a0bf8b690600090a2505050505050565b6120ec61251c565b6001805463ffffffff909216600160b01b0263ffffffff60b01b19909216919091179055565b6060600082516001600160401b0381111561212f5761212f6132ba565b60405190808252806020026020018201604052801561216857816020015b612155613232565b81526020019060019003908161214d5790505b50835190915060005b818110156122a057600d600086838151811061218f5761218f613b65565b6020908102919091018101518252818101929092526040908101600020815161016081018352815463ffffffff8082168352600160201b82041694820194909452600160401b84046001600160a01b03169281019290925290916060830190600160e01b900460ff16600381111561220957612209613631565b600381111561221a5761221a613631565b815260018201546001600160a01b03908116602083015260028301546040830152600383015460608301526004830154608083015260058301541660a0820152600682015460c082015260079091015460e090910152835184908390811061228457612284613b65565b60200260200101819052508061229990613b7b565b9050612171565b50909392505050565b600f60205281600052604060002081815481106122c557600080fd5b6000918252602090912001546001600160a01b038116925063ffffffff600160a01b820481169250600160c01b9091041683565b61230161251c565b600a805463ffffffff191663ffffffff92909216919091179055565b61232561251c565b600955565b61233261251c565b6003805467ffffffffffffffff19166001600160401b0392909216919091179055565b61235d61251c565b600b80546001600160a01b0319166001600160a01b0392909216919091179055565b61238761251c565b60008151116123a85760405162461bcd60e51b8152600401610e1a90613b37565b60005b81518110156111c2576001601160008484815181106123cc576123cc613b65565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061240881613b7b565b9150506123ab565b61241861251c565b6001600160a01b03811661247d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610e1a565b61248681612cb9565b50565b32331461249557600080fd5b6124a2858585858561299c565b600c54604080518681526020810192909252810183905263ffffffff821660608201526000608082015283906001600160a01b0387169033907f8f6fdf5368e64726d02fcbc787bdbea9bb0b858bdc288b0f8e5d7e832a067da49060a00160405180910390a45050505050565b61251761251c565b600655565b6000546001600160a01b03163314611c535760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610e1a565b6000828152600e6020908152604080832054808452600d83528184206005810154600f90945291842054909391926001600160a01b0316910361266857815460068301546040516323b872dd60e01b81526001600160a01b03808516936323b872dd936125f3933093600160401b90930490921691600401613b94565b600060405180830381600087803b15801561260d57600080fd5b505af1158015612621573d6000803e3d6000fd5b5050835460ff60e01b1916600360e01b178455505060405183907f2a7d48246875b5f17dc9944def25fc8fe90e524ca2165e290ffdc0e44a0bf8b690600090a25050505050565b81548451600091600160201b900463ffffffff16908690839061268d5761268d613b65565b602002602001015161269f9190613bf8565b90506126ab8482612d09565b6001840180546001600160a01b0319166001600160a01b0392909216919091179055600783015483546000916126ed91600160201b900463ffffffff16613ac6565b845460ff60e01b1916600360e01b178555600185015460068601546040516323b872dd60e01b81529293506001600160a01b03868116936323b872dd9361273c93309390911691600401613b94565b600060405180830381600087803b15801561275657600080fd5b505af115801561276a573d6000803e3d6000fd5b5050600b54865460405163181744ff60e31b8152600481018a90526001600160a01b03600160401b909204821660248201529116925060009150829063c0ba27f890604401602060405180830381865afa1580156127cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127f09190613c0c565b865463ffffffff919091169150600090600160401b90046001600160a01b031661271061281d8482613c29565b6128279087613ac6565b6128319190613c3c565b604051600081818185875af1925050503d806000811461286d576040519150601f19603f3d011682016040523d82523d6000602084013e612872565b606091505b505090508061288057600080fd5b600a54600160401b90046001600160a01b03166127106128a08487613ac6565b6128aa9190613c3c565b604051600081818185875af1925050503d80600081146128e6576040519150601f19603f3d011682016040523d82523d6000602084013e6128eb565b606091505b505080915050806128fb57600080fd5b600187015460405189916001600160a01b0316907f64791dbae5677392ba76761a5273633cec8f1d9d8cfe808da7bac6ef16a880be90600090a350505050505050505050565b60008060018360600151600381111561295c5761295c613631565b1490506000428460c001511115806129885750836000015163ffffffff16846020015163ffffffff1610155b90508180156129945750805b949350505050565b600b54600160a01b900460ff166129ea5760405162461bcd60e51b8152602060048201526012602482015271149859999b195cc8185c994818db1bdcd95960721b6044820152606401610e1a565b6001600160a01b03851660009081526010602052604090205460ff1615612a455760405162461bcd60e51b815260206004820152600f60248201526e13919508189b1858dadb1a5cdd1959608a1b6044820152606401610e1a565b60135460ff1615612aae576001600160a01b03851660009081526011602052604090205460ff16612aae5760405162461bcd60e51b8152602060048201526013602482015272139195081b9bdd081dda1a5d195b1a5cdd1959606a1b6044820152606401610e1a565b612abf83838363ffffffff16613015565b6040516323b872dd60e01b815285906001600160a01b038216906323b872dd90612af190339030908a90600401613b94565b600060405180830381600087803b158015612b0b57600080fd5b505af1158015612b1f573d6000803e3d6000fd5b5050600c8054925090506000612b3483613b7b565b9190505550612b41613232565b6001600160a01b038716610100820152610120810186905260c081018590524260e0820152610140810184905263ffffffff8316815233604082015260016060820181905250600c5460a082018190526000908152600d60209081526040918290208351815492850151938501516001600160a01b0316600160401b02600160401b600160e01b031963ffffffff958616600160201b0267ffffffffffffffff19909516959092169490941792909217918216831781556060840151849391929091839160ff60e01b1990911668010000000000000000600160e81b031990911617600160e01b836003811115612c3a57612c3a613631565b021790555060808201516001820180546001600160a01b039283166001600160a01b03199182161790915560a0840151600284015560c0840151600384015560e0840151600484015561010084015160058401805491909316911617905561012082015160068201556101409091015160079091015550505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000828152600d60209081526040808320815161016081018352815463ffffffff8082168352600160201b82041694820194909452600160401b84046001600160a01b03169281019290925283926060830190600160e01b900460ff166003811115612d7757612d77613631565b6003811115612d8857612d88613631565b815260018201546001600160a01b03908116602080840191909152600284015460408401526003840154606084015260048401546080840152600584015490911660a0830152600683015460c083015260079092015460e09091015281015190915063ffffffff168310612e345760405162461bcd60e51b8152602060048201526013602482015272125b99195e08191bd95cdb89dd08195e1a5cdd606a1b6044820152606401610e1a565b6000848152600f6020908152604080832080548251818502810185019093528083529192909190849084015b82821015612eba57600084815260209081902060408051606081018252918501546001600160a01b038116835263ffffffff600160a01b8204811684860152600160c01b9091041690820152825260019092019101612e60565b505082519293508391506000905082612ed557612ed5613b65565b60200260200101516020015163ffffffff16600014612ef357600080fd5b60018360200151612f049190613b1a565b63ffffffff1682612f16600184613c29565b81518110612f2657612f26613b65565b60200260200101516040015163ffffffff1614612f4257600080fd5b600080612f50600184613c29565b905060006002612f608385613bb8565b612f6a9190613c3c565b905060005b6001600160a01b038116613006576002612f898486613bb8565b612f939190613c3c565b91506000868381518110612fa957612fa9613b65565b6020026020010151905089816040015163ffffffff161015612fd757612fd0836001613bb8565b9450613000565b89816020015163ffffffff161115612ffb57612ff4600184613c29565b9350613000565b805191505b50612f6f565b96505050505050505b92915050565b6004546130224285613c29565b10156130635760405162461bcd60e51b815260206004820152601060248201526f149859999b19481d1bdbc81cda1bdc9d60821b6044820152606401610e1a565b6005546130704285613c29565b11156130b05760405162461bcd60e51b815260206004820152600f60248201526e526166666c6520746f6f206c6f6e6760881b6044820152606401610e1a565b6007548210156130f95760405162461bcd60e51b81526020600482015260146024820152735469636b657420707269636520746f6f206c6f7760601b6044820152606401610e1a565b6009548211156131425760405162461bcd60e51b81526020600482015260146024820152735469636b657420707269636520746f6f206c6f7760601b6044820152606401610e1a565b60085461314f9083613bf8565b156131915760405162461bcd60e51b815260206004820152601260248201527142616420707269636520666964656c69747960701b6044820152606401610e1a565b600a54600160201b900463ffffffff168110156131e25760405162461bcd60e51b815260206004820152600f60248201526e546f6f20666577207469636b65747360881b6044820152606401610e1a565b600a5463ffffffff1681111561322d5760405162461bcd60e51b815260206004820152601060248201526f546f6f206d616e79207469636b65747360801b6044820152606401610e1a565b505050565b6040805161016081018252600080825260208201819052918101829052906060820190815260200160006001600160a01b0316815260200160008152602001600081526020016000815260200160006001600160a01b0316815260200160008152602001600081525090565b80356001600160a01b03811681146132b557600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156132f8576132f86132ba565b604052919050565b600082601f83011261331157600080fd5b81356001600160401b0381111561332a5761332a6132ba565b61333d601f8201601f19166020016132d0565b81815284602083860101111561335257600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000806080858703121561338557600080fd5b61338e8561329e565b935061339c6020860161329e565b92506040850135915060608501356001600160401b038111156133be57600080fd5b6133ca87828801613300565b91505092959194509250565b6000602082840312156133e857600080fd5b5035919050565b60006020828403121561340157600080fd5b8135801515811461341157600080fd5b9392505050565b602080825282518282018190526000919060409081850190868401855b8281101561347757815180516001600160a01b031685528681015163ffffffff9081168887015290860151168585015260609093019290850190600101613435565b5091979650505050505050565b63ffffffff8116811461248657600080fd5b600080604083850312156134a957600080fd5b8235915060208301356134bb81613484565b809150509250929050565b60006001600160401b038211156134df576134df6132ba565b5060051b60200190565b600082601f8301126134fa57600080fd5b8135602061350f61350a836134c6565b6132d0565b82815260059290921b8401810191818101908684111561352e57600080fd5b8286015b848110156135495780358352918301918301613532565b509695505050505050565b6000806040838503121561356757600080fd5b8235915060208301356001600160401b0381111561358457600080fd5b613590858286016134e9565b9150509250929050565b600060208083850312156135ad57600080fd5b82356001600160401b038111156135c357600080fd5b8301601f810185136135d457600080fd5b80356135e261350a826134c6565b81815260059190911b8201830190838101908783111561360157600080fd5b928401925b82841015613626576136178461329e565b82529284019290840190613606565b979650505050505050565b634e487b7160e01b600052602160045260246000fd5b6004811061366557634e487b7160e01b600052602160045260246000fd5b9052565b805163ffffffff168252602081015161368a602084018263ffffffff169052565b5060408101516136a560408401826001600160a01b03169052565b5060608101516136b86060840182613647565b5060808101516136d360808401826001600160a01b03169052565b5060a081015160a083015260c081015160c083015260e081015160e08301526101008082015161370d828501826001600160a01b03169052565b5050610120818101519083015261014090810151910152565b610160810161300f8284613669565b6000806040838503121561374857600080fd5b6137518361329e565b946020939093013593505050565b6000806020838503121561377257600080fd5b82356001600160401b038082111561378957600080fd5b818501915085601f83011261379d57600080fd5b8135818111156137ac57600080fd5b8660208285010111156137be57600080fd5b60209290920196919550909350505050565b60008060008060008060c087890312156137e957600080fd5b6137f28761329e565b9550602087013594506040870135935060608701359250608087013561381781613484565b915061382560a0880161329e565b90509295509295509295565b60006020828403121561384357600080fd5b813561341181613484565b60006020828403121561386057600080fd5b6134118261329e565b60006020828403121561387b57600080fd5b81356001600160401b0381111561389157600080fd5b61299484828501613300565b821515815260006020604081840152835180604085015260005b818110156138d3578581018301518582016060015282016138b7565b506000606082860101526060601f19601f830116850101925050509392505050565b60006020828403121561390757600080fd5b813561ffff8116811461341157600080fd5b63ffffffff8c811682528b1660208201526001600160a01b038a8116604083015261016082019061394d606084018c613647565b988916608083015260a082019790975260c081019590955260e085019390935294166101008301526101208201939093526101400191909152949350505050565b6000602082840312156139a057600080fd5b81356001600160401b038111156139b657600080fd5b612994848285016134e9565b6020808252825182820181905260009190848201906040850190845b81811015613a05576139f1838551613669565b9284019261016092909201916001016139de565b50909695505050505050565b60008060408385031215613a2457600080fd5b50508035926020909101359150565b600060208284031215613a4557600080fd5b81356001600160401b038116811461341157600080fd5b600080600080600060a08688031215613a7457600080fd5b613a7d8661329e565b94506020860135935060408601359250606086013591506080860135613aa281613484565b809150509295509295909350565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761300f5761300f613ab0565b63ffffffff818116838216019080821115613afa57613afa613ab0565b5092915050565b600060208284031215613b1357600080fd5b5051919050565b63ffffffff828116828216039080821115613afa57613afa613ab0565b6020808252601490820152734572726f723a206c69737420697320656d70747960601b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b600060018201613b8d57613b8d613ab0565b5060010190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b8082018082111561300f5761300f613ab0565b600081613bda57613bda613ab0565b506000190190565b634e487b7160e01b600052601260045260246000fd5b600082613c0757613c07613be2565b500690565b600060208284031215613c1e57600080fd5b815161341181613484565b8181038181111561300f5761300f613ab0565b600082613c4b57613c4b613be2565b50049056fea264697066735822122033dcead1bb18e4b480f318a045fc459bb97533a751e18996ccf49ed3dc9e77f264736f6c63430008110033000000000000000000000000d5d517abe5cf79b7e95ec98db0f0277788aff63483250c5584ffa93feb6ee082981c5ebe484c865196750b39835ad4f13780435d0000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000007a120

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

000000000000000000000000d5d517abe5cf79b7e95ec98db0f0277788aff63483250c5584ffa93feb6ee082981c5ebe484c865196750b39835ad4f13780435d0000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000007a120

-----Decoded View---------------
Arg [0] : vrfCoordinatorV2 (address): 0xd5d517abe5cf79b7e95ec98db0f0277788aff634
Arg [1] : gasLane (bytes32): 0x83250c5584ffa93feb6ee082981c5ebe484c865196750b39835ad4f13780435d
Arg [2] : subscriptionId (uint64): 105
Arg [3] : callbackGasLimit (uint32): 500000

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000d5d517abe5cf79b7e95ec98db0f0277788aff634
Arg [1] : 83250c5584ffa93feb6ee082981c5ebe484c865196750b39835ad4f13780435d
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000069
Arg [3] : 000000000000000000000000000000000000000000000000000000000007a120


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.